<div><br></div><div>   Andre,</div><div><br></div><div>   The consequence of a rule is plain java code, so as long as you import the proper classes and use the API correctly, it will work. Although, it seems to me (looking only at the 2 code snippets bellow) that you could probably simplify things if you inserted message bodies instead of the full exchange into the session.</div>
<div><br></div><div>   My suggestion is for you to define multiple routes and use the session as a dynamic router. Something like this: (using pseudo code)</div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">   &lt;route&gt;<br>
       &lt;from uri=&quot;activemq:personnel.records&quot;/&gt;<br>       &lt;policy ref=&quot;droolsPolicy&quot;&gt;<br>           ...<br>           &lt;to uri=&quot;drools:node1/ksession1?action=insertBody&quot;/&gt;</div>
<div>           ...<br>       &lt;/policy&gt;<br>   &lt;/route&gt;<br></div><div><br></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>   &lt;route&gt;<br>       &lt;from uri=&quot;<meta http-equiv="content-type" content="text/html; charset=utf-8">drools:node1/ksession1?channel=myFile&quot;/&gt;</div>
<div>       &lt;to uri=&quot;file:target/messages/foo&quot;/&gt;</div><div>   &lt;/route&gt;<br></div><div><br></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>   &lt;route&gt;<br>       &lt;from uri=&quot;drools:node1/ksession1?channel=anotherChannel&quot;/&gt;</div>
<div>       &lt;to uri=.../&gt;</div><div>   &lt;/route&gt;<br></div><div><br></div><div><br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">rule &quot;Rule 04&quot;<br>dialect &quot;mvel&quot;<br>
   when<br>       $p : Person()<br>   then</div><div>      channels[&quot;myFile&quot;].send( $p );<br>end<br></div><div><br></div><div>rule &quot;create new person&quot;</div><meta http-equiv="content-type" content="text/html; charset=utf-8">dialect &quot;mvel&quot;<br>
<div>when</div><div>     ...</div><div>then</div><div>      $neu = new Person();</div><div>      $neu.firstname = &quot;I&quot;;<br></div><div>      channels[&quot;anotherChannel&quot;].send( $neu );</div><div>end</div><div>
<br></div><div><br></div><div>   Doing it like that, you separate the concerns more clearly. Camel is responsible for all the middleware communication and transport, while your Drools session will deal with the actual routing logic. It also lets your rules to use arbitrary channel names (e.g., &quot;myFile&quot;, &quot;anotherChannel&quot;) that camel routes will map into actual routes. Finally, all the internals of camel communications (like creating messages, exchanges, etc) are handled transparently for you.</div>
<div><br></div><div>   That is how I would do it. Hope it helps.</div><div><br></div><div>   Edson</div><div><br></div><div class="gmail_quote">2011/6/10 Andre <span dir="ltr">&lt;<a href="mailto:morpheusandre@web.de">morpheusandre@web.de</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">here it is:<br>
my route:<br>
&lt;code&gt;<br>
    &lt;route&gt;<br>
        &lt;from uri=&quot;activemq:personnel.records&quot;/&gt;<br>
        &lt;policy ref=&quot;droolsPolicy&quot;&gt;<br>
            &lt;unmarshal ref=&quot;myjaxb&quot;/&gt;<br>
            &lt;to uri=&quot;drools:node1/ksession1?action=insertExchange&quot;/&gt;<br>
            &lt;routingSlip uriDelimiter=&quot;#&quot;&gt;<br>
                &lt;header&gt;routingSlip&lt;/header&gt;<br>
            &lt;/routingSlip&gt;<br>
            &lt;log loggingLevel=&quot;INFO&quot; message=&quot;Message Received in Drools&quot;/&gt;<br>
            &lt;marshal ref=&quot;myjaxb&quot;/&gt;<br>
            &lt;to uri=&quot;file:target/messages/foo&quot;/&gt;<br>
            &lt;log loggingLevel=&quot;INFO&quot; message=&quot;Message received at<br>
fileendpoint&quot;/&gt;<br>
        &lt;/policy&gt;<br>
    &lt;/route&gt;<br>
&lt;/code&gt;<br>
and now the rule, which works:<br>
&lt;code&gt;<br>
rule &quot;Rule 04&quot;<br>
dialect &quot;mvel&quot;<br>
    when<br>
                $exchange: Exchange()<br>
        eval($exchange.in.body instanceof Person )<br>
<br>
    then<br>
       $p = (Person)$exchange.in.body;<br>
       $exchange.in.setHeader(&quot;routingSlip&quot;,&quot;file:target/messages/hello&quot;);<br>
       System.out.println(&quot;Rule 04 Works &quot; + $p.user);<br>
end<br>
&lt;/code&gt;<br>
but i want to do something like:<br>
&lt;code&gt;<br>
       #$message = new JmsMessage();/doesnt work: &quot;cannot Resolve<br>
Constructor&quot;<br>
       $message = $exchange.copy();<br>
       $neu = new Person();<br>
       $neu.firstname = &quot;I&quot;;<br>
       $message.in.body = $neu;<br>
       $message.in.setHeader(&quot;routingSlip&quot;,&quot;file:target/messages/bar&quot;);<br>
&lt;/code&gt;<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Drools-Camel-Integration-sending-messages-tp3043844p3047520.html" target="_blank">http://drools.46999.n3.nabble.com/Drools-Camel-Integration-sending-messages-tp3043844p3047520.html</a><br>

</font><div><div></div><div class="h5">Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>