It’s in our roadmap to eventually fully support a SOA with proper request/response handling via message queues, so if anyone can help steer us in the right direction would be greatly appreciated.
Thanks for the prompt reply and helping us solve our issue. We had everything configured correctly except for failing to declare the RedisMessageFactory; once we added that, everything worked as intended.
Is it possible to block until we receive a response from the handler?
For that you’d need to use the IMessageQueueClient and it’s Get<T> API, e.g:
public IMessageFactory MqFactory { get; set; }
public object Any(MyRequest request)
{
using (var mqClient = MqFactory.CreateMessageQueueClient())
{
mqClient.Publish(new SendEmail { Email = "test@email.com" });
var response = mqClient.Get<SendEmailResponse>(
QueueNames<SendEmailResponse>.In, TimeSpan.FromMinutes(1));
}
}
Which uses the MQ Request/Reply pattern, which for the Redis MQ Client needs to periodically poll behind the scenes. Although I’d advise against blocking on MQ Services since if you’re going to rely on time-coupling for your System workflow you may as well call a Web Service directly and not go through an intermediary broker since you’re relying on your endpoint being available at the time you call it.