Apache Camel Multicast notifyBuilder fails -


of reason, queue_a not has 1 exchanges - has 0, unless add thread.sleep(100) test. guess whencompleted/whendone isn't done when says it's done. how can verify done?

multicast().parallelprocessing().to(queue_a, queue_b, queue_c, queue_d) 

and testing with:

@test public void test() {     notifybuilder notify = new notifybuilder(context)             .from(queue_incoming)             .whencompleted(1)             .create();     template.sendbody(queue_incoming, streamtostring(loadresourceasstream("/data/testdata.xml")));      boolean matches = notify.matches(4, seconds);     asserttrue("notify failed", matches);     thread.sleep(100); //without this, fails       verifyendpoints(1, context, queue_a, queue_b, queue_c, queue_d); }  public static void verifyendpoints(int expectedsize, modelcamelcontext context, string... endpoints) {     (string endpoint : endpoints) {         browsableendpoint = context.getendpoint(endpoint, browsableendpoint.class);         assertthat(string.format("endpoint exchanges '%s' has wrong size", endpoint), be.getexchanges(), hassize(expectedsize));     } } 

and endpoint bean, using activemq when testing, going use websphere mq in prod:

<bean id="wmq" class="org.apache.camel.component.jms.jmscomponent">     <property name="connectionfactory">       <bean class="org.apache.activemq.activemqconnectionfactory">         <property name="brokerurl" value="vm://localhost?broker.persistent=false" />       </bean>     </property> </bean> 

the problem browse wmq asap after sending message it, , therefore depending on broker implementation , timing etc, may not see last messages, when using jms browsing api.

and hence why seems fix when wait bit sleep.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -