Publish ServiceStack MessageFactory

I looked at the ServiceStack Messaging documentation with Redis:

https://github.com/ServiceStack/ServiceStack/wiki/Messaging-and-redis

It seems to explain the basics very well. What I don’t quite understand is the differences and applicable usage examples when publishing through MessageFactory:

.CreateMessageProducer.Publish() 

and

 .CreateMessageQueueClient.Publish() 

I plan to review the code, but want to publish it here for an β€œofficial” explanation.

+4
source share
1 answer

Here are the IMessageProducer and IMessageQueueClient APIs:

 public interface IMessageProducer : IDisposable { void Publish<T>(T messageBody); void Publish<T>(IMessage<T> message); } public interface IMessageQueueClient : IMessageProducer { void Publish(string queueName, byte[] messageBytes); void Notify(string queueName, byte[] messageBytes); byte[] Get(string queueName, TimeSpan? timeOut); byte[] GetAsync(string queueName); string WaitForNotifyOnAny(params string[] channelNames); } 

Basically, MessageQueueClient is also a MessageProducer , but it contains other fine-grained methods in addition to publishing to Receive Messages from the Queue, as well as publishing and subscribing to any MQ topics.

The dialed Publish<T> API for both the message client and the producer has the same behavior.

+4
source

Source: https://habr.com/ru/post/1445235/


All Articles