Contents
IProviderFactory interface
The IProviderFactory
interface provides factory methods for receiving the interfaces necessary for working with the MessageBus
component.
A description of the IProviderFactory
interface is provided in the file named messagebus/i_messagebus_control.h
.
An instance of the IProviderFactory
interface is obtained by using the free InitConnection()
function, which receives the name of the IPC connection between the application software and the MessageBus
program. The connection name is defined in the init.yaml.in
file when describing the solution configuration. If the connection is successful, the output parameter contains a pointer to the IProviderFactory
interface.
- The interface for registering and deregistering (see "IProviderControl interface") publishers and subscribers in the message bus is obtained by using the
IProviderFactory::CreateBusControl()
method. - The interface containing the methods enabling the publisher to send messages to the bus (see "IProvider interface (MessageBus component)") is obtained by using the
IProviderFactory::CreateBus()
method. - The interfaces containing the methods enabling the subscriber to receive messages from the bus (see "ISubscriber, IWaiter and ISubscriberRunner interfaces") are obtained by using the
IProviderFactory::CreateCallbackWaiter
andIProviderFactory::CreateSubscriberRunner()
methods.It is not recommended to use the
IWaiter
interface, because calling a method of this interface is a locking call.
i_messagebus_control.h (fragment)
class IProviderFactory
{
...
virtual fdn::ResultCode CreateBusControl(IProviderControlPtr& controlPtr) = 0;
virtual fdn::ResultCode CreateBus(IProviderPtr& busPtr) = 0;
virtual fdn::ResultCode CreateCallbackWaiter(IWaiterPtr& waiterPtr) = 0;
virtual fdn::ResultCode CreateSubscriberRunner(ISubscriberRunnerPtr& runnerPtr) = 0;
...
};
...
fdn::ResultCode InitConnection(const std::string& connectionId, IProviderFactoryPtr& busFactoryPtr);