As Gert said, we haven't any generic solution for servicemix 4, though
I was in need for that for the clustering stuff.
The idea is to use an ExchangeListener and intercept new exchanges.
Here is the code I have so far:

    public void exchangeSent(Exchange exchange) {
        // Intercept exchanges
        if (exchange instanceof InternalExchange
                && exchange.getStatus() == Status.Active &&
exchange.getRole() == Role.Consumer
                && exchange.getOut(false) == null &&
exchange.getFault(false) == null) {
            // Filter JBI endpoints
            InternalEndpoint source = ((InternalExchange) exchange).getSource();
            for (ClusterRegistration reg : getServices()) {
                if (reg.match(source)) {

exchange.setTarget(getChannel().getNMR().getEndpointRegistry().lookup(ServiceHelper.createMap(Endpoint.NAME,
name)));
                    return;
                }
            }
        }
    }

As you can see, the exchange is routed and the target overwritten.
This will re-route the exchange to a known endpoint.
In this case, the old target is discarded and will be recreated by the
endpoint itself, because we still have the JBI addressing properties
available.   Another way would be to save the old target into a
property on the exchange that would be later used by the endpoint.

On Thu, Feb 5, 2009 at 11:59, Gabriela Gheorghe
<[email protected]> wrote:
> Hi,
>
>
>
> I need to do a bit of tuning inside the NMR so that messages sent to and
> from the SAs could be transparently sent to a certain configurable endpoint
> prior to taking their actual route. This of course without having to change
> the routes already associated with the deployed components.
>
>
>
> Could you please tell me what I should do/use in this case?
>
>
>
> Thanks in advance,
>
> Gabriela
>
>
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Reply via email to