Ok, so I see.. the chooser only comes into effect if the endpoint you are
targeting hasn't been resolved, which I see by looking at the DefaultBroker
(resolveAddress method on 309):
if (theEndpoint == null) {
...
theEndpoint = getServiceChooser(exchange).chooseEndpoint(endpoints,
context, exchange);
...
}
if (theEndpoint != null) {
exchange.setEndpoint(theEndpoint);
}
So it looks like really my issue, since the services have the same
servicename and endpoint name must be that activemq is load balancing across
those services which isn't really what I want.. or at least it is in certain
cases but not in other....so I guess I really have to figure out how to
change that to how I need instead...
On Fri, Mar 26, 2010 at 3:55 PM, Ryan Moquin <[email protected]> wrote:
> I'm trying to get a servicemix endpoint chooser to work. I tried to add it
> as Guillaume previously suggested by adding this to the servicemix.xml
>
> <bean factory-method="getBroker" factory-bean="jbi">
> <property name="defaultServiceChooser">
> <bean class="test.CustomEndpointPolicy" />
> </property>
> </bean>
>
> Everything starts up correctly after I add it, but for some reason my
> policy is never invoked. I turned on debug and set a breakpoint and I don't
> see it. All I see when I refresh a web browser that is connecting to a
> servicemix-http SU, is that my response toggles back and forth as if the
> exchange gets load balanced among an SU that I have deployed on two
> clustered instances, which is not what my policy does. I also tried to set
> the defaultServiceChooser property directly on the Secured Broker element
> and that hasn't helped either. Has anything changed in this regard with
> Fuse ESB 3.4.0.4? Also, if the default is first endpoint first policy, it's
> strange that the ordering isn't consistent for where the exchange goes,
> unless it's random on the ordering of the possible endpoints presented to
> the chooser at routing time...
>
> Ryan
>