ReferenceApplication Consumer - Data Logger
Common Tasks
Working through this tutorial gives you an introductory understanding of the steps required to implement Consumer
role of OOI Reactive Application
. DataLogger
is a sample implementation of the Consumer
part of the ReferenceApplication
, which is an example application of Semantic-Data
reactive networking based on OPC UA Part 14 Pub/Sub specification.
Here are steps undertook to implement the Consumer
role in the application:
DataManagementSetup
: this class has been overridden by theLoggerManagementSetup
class and it initializes the communication and binds data fields recovered form messages to local resources.IEncodingFactory
andIMessageHandlerFactory
: has been implemented in external common libraries andConsumer
doesn't depend on this implementation - current implementation of the interfaces is localized as services using an instance of theIServiceLocator
interface.IBindingFactory
: has been implemented in the classDataConsumer
that is responsible to synchronize the values of the local data repository properties and messages received over the wire.IConfigurationFactory
: the classConsumerConfigurationFactory
implements this interface to be used for the configuration file opening.
How to Guide
How to: Implement DataManagementSetup
DataManagementSetup
The LoggerManagementSetup
constructor initializes all properties, which are injection points of all parts composing this role.
In this example, it is assumed that ServiceLocator
is implemented to resolve references to any external services.
Finally the DataManagementSetup.Start()
method is called to initialize the infrastructure, enable all associations and start pumping the data.
How to: Implement IBindingFactory
Implementation of this interface is a basic step to implement Consumer
functionality. An instance of the IBindingFactory
is responsible to create objects implementing IBinding
that can be used by the Consumer
to save the data received over the wire in the local data repository.
The class DataConsumer
is a sample implementation of a data logger functionality recording data over time. It consumes the testing data sent and updates properties in the class ConsumerViewModel
implementing ViewModel layer in the Model View ViewModel (on MSDN) (MVVM pattern). The class DataConsumer
demonstrates how to create bindings interconnecting the data received over the wire and the properties that are the ultimate destination of the data. The user interface provided by the View layer implemented in the UAOOI.Networking.ReferenceApplication.MainWindow
class is dynamically bounded at run time with the ConsumerViewModel
. To implement the ViewModel layer in the *MVVM pattern* the helper generic class
UAOOI.Networking.SemanticData.DataRepository.ProducerBindingMonitoredValue` is used.
How to: Implement IConfigurationFactory
IConfigurationFactory
Implementation of this interface is straightforward and based entirely on the library UAOOI.Configuration.Networking
. In a typical scenario, this implementation should not be considered for further modification. The only open question is how to provide the name of the file containing the configuration of this role. In proposed solution the name is provided by a service defined by the application entry point part and localized using IServiceLocator
in the class LoggerManagementSetup
- see code snipped below:
This role uses independent configuration file ConfigurationDataConsumer.xml
attached to the project. This file contains a mirror configuration of the Producer
role configuration to log all the generated data.
Current release
Note; This library is not considered to be published as the NuGet package.
See also
API Browser: the preliminary code help documentation - available for sponsors- consider joining
Last updated