You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by "Maxim Y. Tebenev" <mt...@softech.ru> on 2006/12/26 20:23:23 UTC

Groovy script as in-out endpoint

Hello Guillaume,

My Groovy scripts now alive and I want to use it as in-out endpoint. But
when I configured pipeline and made SMX deployment I've got "illegal
exchange status: done" error. According to previous posts, I must send
exchange rather than setting DONE state (that done automatically as I
suppose). 
How I can do that in inline Groovy script? Please, help me with that.        

Best regards, Maxim Tebenev.
-- 
View this message in context: http://www.nabble.com/Groovy-script-as-in-out-endpoint-tf2883451s12049.html#a8056140
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Groovy script as in-out endpoint

Posted by "Maxim Y. Tebenev" <mt...@softech.ru>.
Grégoire, thanks for the answer!

I've finally found the source of 'illegal exchange status: done' error. It
caused by

<property name="disableOutput"> 
  <value>true</value> 
</property> 

in script configuration.

Best regards, Maxim Tebenev.

-- 
View this message in context: http://www.nabble.com/Groovy-script-as-in-out-endpoint-tf2883451s12049.html#a8061708
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Groovy script as in-out endpoint

Posted by "Grégoire A." <ke...@yahoo.fr>.
Hi Maxim,

Normally, you don't need to create an other MExchange, 
eip process send a InOut message to the transformer service.
you must have $outMessage variable in yours groovy runtime context. 
just put your result into outMessage like this :

--------------------------------------------------------
def retour  = '''<?xml version="1.0"
encoding="UTF-8"?><StringResponse><StringResult>Hello
World</StringResult></StringResponse>'''

outMessage.setContent(new StringSource(retour))
--------------------------------------------------------
the groovy(script) component send back the message to the eip process.
after that eip process will send the groovy response script to your
"hb:whpipeline" service.

Cordially

Grégoire A.


Le mardi 26 décembre 2006 à 12:49 -0800, Maxim Y. Tebenev a écrit : 
> Answering to myself partly:
> 
> import javax.jbi.messaging.ExchangeStatus
> import javax.jbi.messaging.InOnly
> import javax.jbi.messaging.NormalizedMessage
> 
> println inMessage.properties
> 
> InOnly exchange2 =
> deliveryChannel.createExchangeFactory().createInOnlyExchange(); 
> NormalizedMessage newmessage = exchange2.createMessage(); 
> exchange2.setInMessage(newmessage); 
> deliveryChannel.send(exchange2); 
> 
> This solves previous issue but another one appears:
> I've got 'Could not find route for exchange' error. I suppose that container
> should specify target according to activation spec. I'm running this script
> in lwcontainer component and configured eip:
> 
>   <eip:pipeline service="hb:shoppipeline" endpoint="shoppipelineEP">
>     <eip:transformer>
>       <eip:exchange-target service="hb:groovytrans1" />
>     </eip:transformer>
>     <eip:target>
>       <eip:exchange-target service="hb:whpipeline" />
>     </eip:target>
>   </eip:pipeline>
>  
> So it should be routed to hb:whpipeline service. Am I wrong?
> 
> Best regards, Maxim Tebenev.

-- 
Grégoire A.
_______________________________
keogaa-ddo@yahoo.fr


	

	
		
___________________________________________________________________________ 
D�couvrez une nouvelle fa�on d'obtenir des r�ponses � toutes vos questions ! 
Profitez des connaissances, des opinions et des exp�riences des internautes sur Yahoo! Questions/R�ponses 
http://fr.answers.yahoo.com

Re: Groovy script as in-out endpoint

Posted by "Maxim Y. Tebenev" <mt...@softech.ru>.
Answering to myself partly:

import javax.jbi.messaging.ExchangeStatus
import javax.jbi.messaging.InOnly
import javax.jbi.messaging.NormalizedMessage

println inMessage.properties

InOnly exchange2 =
deliveryChannel.createExchangeFactory().createInOnlyExchange(); 
NormalizedMessage newmessage = exchange2.createMessage(); 
exchange2.setInMessage(newmessage); 
deliveryChannel.send(exchange2); 

This solves previous issue but another one appears:
I've got 'Could not find route for exchange' error. I suppose that container
should specify target according to activation spec. I'm running this script
in lwcontainer component and configured eip:

  <eip:pipeline service="hb:shoppipeline" endpoint="shoppipelineEP">
    <eip:transformer>
      <eip:exchange-target service="hb:groovytrans1" />
    </eip:transformer>
    <eip:target>
      <eip:exchange-target service="hb:whpipeline" />
    </eip:target>
  </eip:pipeline>
 
So it should be routed to hb:whpipeline service. Am I wrong?

Best regards, Maxim Tebenev.

-- 
View this message in context: http://www.nabble.com/Groovy-script-as-in-out-endpoint-tf2883451s12049.html#a8056785
Sent from the ServiceMix - User mailing list archive at Nabble.com.