ICommunicationComponent::CreateOutMessage

Returns the dispatch interface of an OutMessage object. If the OutMessage object could not be created, the return value is NULL.

Parameter:

Destination [In]

The syntax for the Destination parameter is:

Bus adapter type://destination

For example, Named pipe://myServer/myPipe

 

When using the MSMQ Bus Adapter, you set the destination queue either from the CreateOutMessage or from the OpenWriteQueue. It is faster to set the target queue in the OpenWriteQueue if you are going to send several messages. This is because the queue is only opened once. The following examples send a message to the same queue.

 

Example 1

MQBus.OpenWriteQueue('MyMessageQueueServer\MyQueue',0,0);

OutMsg := CC2.CreateoutMessage('Message queue://');   // Use Queue set in OpenWriteQueue

OutS:= OutMsg.GetStream();

OutS.WRITE('Hello world!');

OutMsg.Send(0);

 

Example 2

OutMsg := CC2.CreateoutMessage('Message queue://MyMessageQueueServer\MyQueue');

OutS:= OutMsg.GetStream();

OutS.WRITE('Hello world!');

OutMsg.Send(0);

 

If you have specified the queue in the CreateOutMessage, you set Mode and Protocol in the OutMessage properties. If you have not specified the queue in the CreateOutMessage, the Mode and Protocol used are the ones described in the parameters of OpenWriteQueue. You cannot override the values using the properties in OutMessage.

 

More information:

ICommunicationComponent Interface