[rabbitmq-discuss] Implementation of EAI Detour Pattern with the JAVA API v2.8.7

Tim Watson tim at rabbitmq.com
Fri Oct 26 09:47:42 BST 2012


Hi - where does the detour need to go? This kind of content based routing is normally dealt with via a control bus, although you could implement the choice logic using a headers or topic exchange. The *big* question is where this detour takes you - is it to another consumer that is acting as a content enricher, which sounds like what you've described? Anyway, we'd need a bit more information to make any useful suggestions I think

a) where does the additional content come from?
b) is this (a) running in another Java/AMQP client?
c) *how* do you decide to get to (a)? Can you make this decision based on message headers/properties?

If the answer to (b) is 'yes' then you can probably do something quite easily. Bare in mind that any AMQP client can inspect message headers as well as content. So the following points might help you figure this out...

- your (a) is a good example of a Content Enricher
- you can keep track of where messages have been by adding a Routing Slip
- if your Content Enricher is another AMQP client, it can add additional headers and resend transformed messages anywhere it likes
- RabbitMQ provides exchanges that can be used to route messages based on routing keys or header properties

With all those facilities at your disposal, you should be able to do everything you need:

* route messages that 'need enrichment' to the correct processor, based on the presence/lack of a Routine Slip
* route messages marked as 'complete' directly, based on the presence/value of a Routing Slip

I'd need to know more to suggest anything more specific. I can also suggest that frameworks like Spring Integration and Apache Camel provide neat capabilities for integrating with RabbitMQ (using AMQP of course) so that you can write your processing/enriching and header munging code easily.

HTH

Cheers,
Tim


On 26 Oct 2012, at 09:14, Chikhi Mimoun wrote:

> Hi,
>  
> I juste began few days ago on rabbitmq and I need some help.
>  
> a part of the project is :
> - we have a producer that send a message (sometimes with less data)
> - we have a consumer that receive the message but needs all datas.
>  
> So, sometimes, after the message sent, we need to make a detour in order to complete the message,
> before being re-sent to the consumer.
>  
> It's a kind of content-based routing.
>  
> I found a pattern that matches with this case : the Detour Pattern.
>  
> Is it possible to implement this with the current rabbitmq java API and how ?
>  
> thx.
>  
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss



More information about the rabbitmq-discuss mailing list