Service Bus Buffers

In the service bus, every URI in the service namespace is actually an addressable messaging junction. The client can send a message to that junction, and the junction can relay it to the services. However, each junction can also function as a buffer (see Figure 11-12).

Buffers in the service bus

Figure 11-12. Buffers in the service bus

Unlike the buffers used with the one-way relay binding, the messages are stored in the buffer for a configurable period of time, even when no service is monitoring the buffer. Note that multiple services can monitor the buffer, but only one of them will be able to retrieve the message.

The client is decoupled from the services behind the buffer, and the client or the service need not be running at the same time. Since the client interacts with a buffer and not with an actual service endpoint, all the messages are sent one-way, and there is no way (out of the box) to obtain the results of the message invocation or any errors.

Buffers Versus Queues

The service bus buffers should not be equated with queues (such as MSMQ queues, discussed in Chapter 9), as there are a number of crucial differences:

  • The service bus buffers are not durable and the messages are stored in memory. This implies the risk of losing messages in the (somewhat unlikely) event of a catastrophic failure of the service bus itself.

  • The service bus buffers are not transactional and both sending and ...

Get Programming WCF Services, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.