Arif,

You shouldn't set the DONE status if you're in the provider role of an InOut exchange. You only have to answer the request (set the 'out' message as you've done) and send it.

Gert

Arif Mohd wrote:
Hi Gert,

    Iam little bit confused i have written my method as follows

    public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
        log.info("Received
message________________Exchange8____________________ ");
        if (exchange.getStatus() == ExchangeStatus.DONE) {
            return;
        }
        NormalizedMessage message = exchange.getMessage("in");
        //getMessageList().addMessage(message);
        // TODO ... handle the in message
        // If the MEP is an InOnly, RobustInOnly, you have to set the
exchange to DONE status
        // else, you have to create an Out message and populate it
        // For now, just echo back
        message.setProperty("ActorID","arif");
        NormalizedMessage out = exchange.createMessage();
        out.setContent(message.getContent());
        exchange.setMessage(out, "out");
        //channel.send(exchange);

        if (exchange.getStatus() == ExchangeStatus.DONE) {
            context.getDeliveryChannel().send(exchange);
        }
        else{
        exchange.setStatus(ExchangeStatus.DONE);
        context.getDeliveryChannel().send(exchange);
        }
    }


and iam getting the following exception

INFO  - MessageInterceptor             - Received
message________________Exchange8____________________
___________________Enered else _________________________
INFO  - MessageInterceptor             - Received
message________________Exchange8____________________
___________________Enered else _________________________
ERROR - SedaQueue                      -
[EMAIL PROTECTED] got error
processing InOut[
  id: ID:EC4T16INT165110-2253-1181053111979-5:54
  status: Done
  role: provider
  service: {http://xxx.com/bescocr_031807}BESMessageInterceptor
  endpoint: endpoint
  in: <My XML Message>
  out:<My XML Message>
]
javax.jbi.messaging.MessagingException: illegal exchange status: done
        at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:583)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:370)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:417)
        at
com.intel.e2e.bes.processor.MessageInterceptor.onMessageExchange(MessageInterceptor.java:78)
        at
org.apache.servicemix.components.util.ComponentAdaptorMEListener.onMessageExchange(ComponentAdaptorMEListener.java:47)

        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:593)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:595)
ERROR - SedaQueue                      -
[EMAIL PROTECTED] got error
processing InOut[
  id: ID:EC4T16INT165110-2253-1181053111979-5:55
  status: Done
  role: provider
  service: {http://xxx.com/bescocr_031807}BESMessageInterceptor
  endpoint: endpoint
  in: <My XML Message>
  out:<My XML Message>
]
javax.jbi.messaging.MessagingException: illegal exchange status: done
        at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:583)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:370)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:417)
        at
com.intel.e2e.bes.processor.MessageInterceptor.onMessageExchange(MessageInterceptor.java:78)
        at
org.apache.servicemix.components.util.ComponentAdaptorMEListener.onMessageExchange(ComponentAdaptorMEListener.java:47)

        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:593)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:595)
[Fatal Error] :-1:-1: Premature end of file.
[Fatal Error] :-1:-1: Premature end of file.

what iam doing wrong here ?


Gert Vanthienen wrote:
Arif,

Take a look at the 'Invocation example' drawing on the bottom of page http://incubator.apache.org/servicemix/5-jbi.html.

This explains what is happening in your POJO. First it accepts a request (status = ACTIVE) and it is supposed to set the response (the 'out' message). That is why you get the second exception (after you remove the call to setStatus(DONE) : you should first set the response message before sending it back again. You can use the helper methods on the MessageUtil class if you just want to start by returning the incoming message.

You get the same message exchange a second time, after your consumer (i.c. your eip:pipeline) has received the response and has set the DONE status. You shouldn't be setting that in this case. Probably, you're fine if you just add this snippet to the beginning of your method, ignoring DONE message exchanges.
    if (exchange.getStatus() == ExchangeStatus.DONE) {
            return;
        }

Gert

Arif Mohd wrote:
Gert,
I have removed destinationservice for the pojo from servicemix.xml and
iam using eip:pipleine as suggested by you but iam getting the following
exception now.

   Now my configuration is wireTap--->Pipeline-->JMS Topic (Pipline will
call POJO)

Exception is

]
javax.jbi.messaging.MessagingException: illegal exchange status: done
        at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:583)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:370)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:417)
        at
com.intel.e2e.bes.processor.MessageInterceptor.onMessageExchange(MessageInterceptor.java:70)
        at
org.apache.servicemix.components.util.ComponentAdaptorMEListener.onMessageExchange(ComponentAdaptorMEListener.java:47)

        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:593)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:595)


if i remove the line  "exchange.setStatus(ExchangeStatus.DONE);" then iam
getting the following exception
  error: java.lang.IllegalStateException: Exchange status is Active but
has
no Out nor Fault message
]
javax.jbi.messaging.MessagingException: illegal call to send / sendSync
        at
org.apache.servicemix.jbi.messaging.MessageExchangeImpl.handleSend(MessageExchangeImpl.java:571)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:370)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:417)
        at
com.intel.e2e.bes.processor.MessageInterceptor.onMessageExchange(MessageInterceptor.java:70)
        at
org.apache.servicemix.components.util.ComponentAdaptorMEListener.onMessageExchange(ComponentAdaptorMEListener.java:47)

        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:593)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:595)


When to use ExchangeStatus.DONE ?

shall i have to change the code in the line NormalizedMessage message = exchange.getMessage("in");

Iam using the reciever component as it is provided in servicemix site
just
by changing the servicename as suggested by you.






Gert Vanthienen wrote:
Arif,

If you have a DOMSource as the content, you can use getNode() to navigate the content or use e.g. XPath to get the data out of there.

I don't know how you can send a message to the destinationService you configured in your XML file. I usually take an eip:pipeline, which receives the InOnly message, does the InOut call to the POJO and sends the result to the next hop.

Gert

Arif Mohd wrote:
Yes iam able to delploy the POJO componet.

   I have given the servicename correctly in init method and iam able
to
invoke the pojo but the message is not going to destination after this
i.e,
to the topic , configuration for JMSConsumer is as follows

    <jms:endpoint service="bescocr:JMSConsumer"
                  endpoint="jms"
role="consumer" destinationStyle="topic"
                  jmsProviderDestinationName="PHB800"
connectionFactory="#jmsFactory" defaultMep="http://www.w3.org/2004/08/wsdl/in-only"; />

  <bean id="jmsFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
        <property name="connectionFactory">
            <bean
class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL"
value="tcp://localhost:61616"/>
            </bean>
</property> </bean>
One more question How to get the value of a specific tag from the
message
which i got in onMessageExchange method?

When i print the value of message.getContent() iam getting output as
folllows

[EMAIL PROTECTED]
  - MessageInterceptor             - Received message InOnly[
: ID:EC4T16INT165110-4176-1181029075183-5:64
atus: Active
le: provider
rvice: {http://xxx.com/bescocr_031807}BESMessageInterceptor
dpoint: endpoint
: <?xml version="1.0" encoding="UTF-8"?><Address
xmlns:env="http://www.w3.org/2003/05/soap-envelope"; xmlns:http=
p://model.besgv.e2e.xxx.com"
xmlns:ns1="http://www.w3.org/2001/XMLSchema-instance";
xmlns:urn="urn:soap:bes-binding">
<Body>
<FirstName>yyy</FirstName>
<eid>123</eid>
</Body>
</Address>

i need to get the value of eid and set the one message property to that
value


Arif Mohd wrote:
i have added this configuration to conf/servicemix.xml
Gert Vanthienen wrote:
Arif,

Have you added this configuration to conf/servicemix.xml or have you
built a servicemix-lwcontainer SU to hold you service?

Have you activated the endpoint?  Something like:
        public void init(ComponentContext context) throws JBIException {
                this.context = context; 
                context.activateEndpoint(new QName("http://your.namespace";,
"service"),
"endpoint");
        }

Gert


Arif Mohd wrote:
Hi,

   Iam using servicemix3.1 my components configuration is as
follows.

wire tap --> POJO class --->  JMS Topic

I have configured POJO class as follows in servicemix.xml

  <sm:activationSpecs>
     <sm:activationSpec id="BESMessageInterceptor"
service="foo:BESMessageInterceptor"
destinationService="bescocr:JMSConsumer">
     <sm:component><bean
class="com.e2e.bes.processor.MessageInterceptor"/></sm:component>
     </sm:activationSpec>
  </sm:activationSpecs>


And my pojo class method is
public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
        log.info("Received message " + exchange);
        NormalizedMessage message = exchange.getMessage("in");
        System.out.println("_______________hai__________");
        getMessageList().addMessage(message);
        exchange.setStatus(ExchangeStatus.DONE);
        context.getDeliveryChannel().send(exchange);
    }


when i start my servicemix pojo class gets deployed the following
output
depicts that


INFO  - JBIContainer                   - Activating component for:
[container=ServiceMix,name=BESMessageInterceptor] with service
: BESMessageInterceptor component:
org.apache.servicemix.components.util.ComponentAdaptorMEListener for
com.e2e.bes.process
[EMAIL PROTECTED]
INFO  - ComponentMBeanImpl             - Initializing component:
BESMessageInterceptor
INFO  - ComponentMBeanImpl             - Setting running state for
Component: servicemix-bpe to Started

But when i send a message to wire tap iam getting the following
exception



WARN  - DefaultBroker                  - ServiceName
(BESMessageInterceptor) specified for routing, but can't find it
registered
WARN  - DefaultBroker                  - ServiceName
(BESMessageInterceptor) specified for routing, but can't find it
registered
ERROR - EIPComponent                   - Error processing exchange
InOnly[
  id: ID:EC4T16INT165110-2355-1180969168607-5:38
  status: Active
  role: provider
  service: {http://xxx.com/bescocr_031807}PipetoJmsTapSvc
  endpoint: endpoint
  in: <?xml version="1.0" encoding="UTF-8"?>
<Actual message which i got in tap>]
javax.jbi.messaging.MessagingException: Could not find route for
exchange: InOnly[
  id: ID:EC4T16INT165110-2355-1180969168607-5:40
  status: Active
  role: provider
  service: BESMessageInterceptor
  in: <?xml version="1.0" encoding="UTF-8"?>

<Actual message which i got in tap>] for service:
BESMessageInterceptor
and interface: null
        at
org.apache.servicemix.jbi.nmr.DefaultBroker.sendExchangePacket(DefaultBroker.java:295)
        at
org.apache.servicemix.jbi.security.SecuredBroker.sendExchangePacket(SecuredBroker.java:80)
        at
org.apache.servicemix.jbi.container.JBIContainer.sendExchange(JBIContainer.java:793)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.doSend(DeliveryChannelImpl.java:381)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.send(DeliveryChannelImpl.java:417)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.sendConsumerExchange(AsyncBaseLifeCycle.java:546)
        at
org.apache.servicemix.common.EndpointDeliveryChannel.send(EndpointDeliveryChannel.java:77)
        at
org.apache.servicemix.common.endpoints.SimpleEndpoint.send(SimpleEndpoint.java:67)
        at
org.apache.servicemix.eip.patterns.WireTap.sendToListenerAndTarget(WireTap.java:258)
        at
org.apache.servicemix.eip.patterns.WireTap.processAsync(WireTap.java:204)
        at
org.apache.servicemix.eip.EIPEndpoint.process(EIPEndpoint.java:160)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:489)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:441)
        at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(BaseLifeCycle.java:46)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:593)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:174)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
        at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:595)




Reply via email to