[ 
https://issues.apache.org/activemq/browse/SM-1248?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea Zoppello reopened SM-1248:
---------------------------------


The provided JBI Helper cause problem when you've sa that

1) Has chained drools endpoint ( in drl file where routing with jbi.route to 
another drools endpoint)

2) You're testing this with concurrent messages ( high load )

The problems seems to be that the provided route method in jbi helper, use 
sensSync instead of send.

I provide a new code for route method, that i've tested and solve the problem:

public void routeTo(String content, String uri) throws MessagingException {
        
        
        MessageExchange me = this.exchange.getInternalExchange();
        
        if ((me instanceof InOnly) || (me instanceof RobustInOnly)) {
                 NormalizedMessage in = null;
                if (content == null){
                        in = me.getMessage("in");
                } else{
                        in = me.createMessage();
                    in.setContent(new StringSource(content));
                }
                MessageExchange newMe = 
getChannel().createExchangeFactory().createExchange(me.getPattern());
                URIResolver.configureExchange(newMe, getContext(), uri);
                MessageUtil.transferToIn(in, newMe);
              
                // If i am in route method could send back the done 
                me.setStatus(ExchangeStatus.DONE);
                getChannel().send(me);
                
                // And send forward the new me
                getChannel().send(newMe);
                update();
              
                        
                }else{
                        throw new IllegalStateException(" route method should 
be used for InOnly or Robus In Only Exchange for InOutExchange use answer");
                }
       
    }



> ServiceMix Drools Enhancements
> ------------------------------
>
>                 Key: SM-1248
>                 URL: https://issues.apache.org/activemq/browse/SM-1248
>             Project: ServiceMix
>          Issue Type: Improvement
>          Components: servicemix-drools
>    Affects Versions: 3.2.1
>            Reporter: Andrea Zoppello
>            Assignee: Guillaume Nodet
>             Fix For: 3.2.2, 3.3
>
>         Attachments: DroolsEndpoint.java.patch, JbiHelper.java.patch
>
>
> To be complete the servicemix 3.2.1 drools components, require some 
> enhancements:
> 1) There's the need to support a default destination, where exchange will be 
> routed if none rules in the drools file is verified.
> To support this, we need to provide a way to specify default destinations. 
> there will be a defaultTargetService ( QName ) attribute and a 
> defaultTargetURI attribute in drools endpoint class. ( defaultTargetURI will 
> have the precedence on defaultTargetServiceAttribute)
> 2) We must add the possibility to configure not only global "objects" for 
> memory but also a list of "asserted objects" to be asserted in memory ( so 
> it's possible to use that objects in LHS part of rules )
> 3) The actual code of jbi helper does not care about sender and correlation 
> id.
> 4) We need a method in jbi helper object to support the concept of  fault 
> withn the flow, ( to default destination ) without generate a jbi fault. a 
> fault in flow from jbi point of view is a "correct" normalized message.
> The attached patches solve all the above in a very generic way.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to