Getting Started

This section contains step by step instructions about how to start using CBFS IPC in your application:

  1. First of all you need to understand the ideology of CBFS IPC, i.e. its message-oriented nature.
  2. CBFS IPC is a transport, that can be used as a backend for application-level protocols. Even if you send only one message and don't get replies, this is also a protocol (although very simple). So you need to design a protocol. Of course, you can leave this step for future, when your application is built.
  3. Now it is time to add CBFS IPC to your application. First step is to add an instance of Messenger class.
  4. Once the messenger is added, it is desirable to add an instance of Queue class and link it to Messenger using Queue.Messenger property. A Queue is a way for your application to receive messages, that were sent. It is like a "post box" to which messages are sent.
  5. If you want to process all messages for the queue in one routine, you need to set a handler for Queue.OnUnhandledMessage event. The alternative is to add one or more MessageHandler objects using Handlers.Add method (the reference to Handlers object can be obtained from Queue instance using Queue's Handlers property) and set a handler for Handler.OnMessage event.
  6. Now you need to add one or more transport. A Transport is what will deliver your messages to recipients. CBFS IPC offers several transport classes with more transports to be added later. A Transport should be linked to Messenger using BaseTransport.Messenger property.
  7. (Optional) If you need to encrypt, sign or compress your data, you can add one or more Transformers. To link the Transformer to the Messenger you need to use the transformer's Messenger property.

That's all you need to have CBFS IPC working for you.
Now you need to send and receive a message.

Sending a message is done via one of the following methods:

If you've created a Queue object, messages are dispatched via Queue and Handler objects. All you will need is to call Messenger.DispatchMessages method periodically to let messenger call proper event handlers.
There is another option to receive messages available -- via Messenger.GetMessage and Messenger.PeekMessage methods. If you use these methods to get the message from the message queue, you will need to call Messenger.MessageProcessed method when the message is processed, so that the messenger can send a result and dispose of message data.

There are several schemes available if you want to see graphic representation of CBFS IPC. The first of them is a high-level representation of CBFS IPC and its place in your application. The second one, General Scheme shows relationships between classes in CBFS IPC. The third, Delivery Scheme, describes a process of message delivery using SendMessage function.