Skip to content

Messaging options

Sunny Ahuwanya edited this page Jan 28, 2016 · 2 revisions

When sending a message, you can specify options that override the routing/processing decisions made by the message mapper for that message.

var options = new RequestOptions();
var res = await client.PostAsJsonAsync("hello/random", msg, options);

In the code example above, the following properties can be set on the options object to influence message routing/processing.

ExpectsReply: Set to true to indicate the client will wait for a reply, false otherwise.

Cookies: HTTP Cookies to be sent along with the message, can be added to this property.

Headers: HTTP Headers to be sent along with the message, can be added to this property.

Properties: This can be set to a broker-specific property that can be used to influence broker-specific messaging decisions. For RabbitMQ, see the RabbitMQMessagingProperties class

ServiceName: The name of the service to route messages to.
NOTE: This property is not yet supported. Only one service per client is currently supported.

Tag: This can be set to a custom object that can be used by a message mapper to make messaging decisions. See what is a message mapper.

Timeout: This controls the amount of time the client will wait for a response.
Set it to Timeout.Zero to indicate that the message is a one way message, and no response is expected.
Set it to System.Threading.Timeout.InfiniteTimeSpan to indicate that the client should wait indefinitely until a response is received.

Clone this wiki locally