Hi Bruce,

Thanks for your reply.

The steps I have performed while working with Geronimo are:
1. Downloaded the Apache_ServiceMix_Web_Application-3.2.1.war file from
the URL given below:
http://servicemix.apache.org/download.html

2. Deployed the shared library and all required servicemix components
using Servicemix Web Application.

3. Deployed my servicemix service-assembly. It started properly. And my
running service is displayed on the below url:
http://localhost:8080/Servicemix-web/jbi

4. What I observed is when I make a call to my http consumer component I
am not getting any response on the browser which ideally should be
displayed as I am using a In-Out MEP.

I am sending the code for my MessageExchangeListener.
Please look into this and help me.


package org.apache.servicemix.jbi;

import java.util.Stack;
import java.util.StringTokenizer;

import javax.annotation.Resource;
import javax.jbi.messaging.DeliveryChannel;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
import javax.jbi.messaging.MessageExchange.Role;

import org.apache.log4j.Logger;
import org.apache.servicemix.MessageExchangeListener;
import org.apache.servicemix.jbi.jaxp.StringSource;

public class MyBean implements MessageExchangeListener {
        private static final Logger logger =
Logger.getLogger(MyBean.class);

        @Resource
        private DeliveryChannel channel;

        public void onMessageExchange(MessageExchange exchange)
                        throws MessagingException {
                if (exchange == null) {
                        return;
                }

                if (exchange.getRole() == Role.CONSUMER) {
                        onConsumerExchange(exchange);
                }

                else if (exchange.getRole() ==
MessageExchange.Role.PROVIDER) {
                        onProviderExchange(exchange);
                }

                else {
                        throw new MessagingException(
                                        "MyBean.onMessageExchange():
Unknown role: "
                                                        +
exchange.getRole());
                }
        }

        /**
         * handles the incoming consumer messages
         *
         * @param exchange
         * @throws MessagingException
         */
        private void onConsumerExchange(MessageExchange exchange)
                        throws MessagingException {
                // Out message
                if (exchange.getMessage("out") != null) {
                        exchange.setStatus(ExchangeStatus.DONE);
                        channel.send(exchange);
                }

                // Fault message
                else if (exchange.getFault() != null) {
                        exchange.setStatus(ExchangeStatus.DONE);
                        channel.send(exchange);
                }

                // This is not compliant with the default MEPs
                else {
                        throw new MessagingException(
                                        "MyBean.onConsumerExchange():
Consumer exchange is ACTIVE, but no out or fault is provided");
                }

        }
        /**
         * handles the incoming provider messages
         *
         * @param exchange
         * @throws MessagingException
         */
        private void onProviderExchange(MessageExchange exchange)
                        throws MessagingException {
                // Exchange is finished
                if (exchange.getStatus() == ExchangeStatus.DONE) {
                        return;
                }
                // Exchange has been aborted with an exception
                else if (exchange.getStatus() == ExchangeStatus.ERROR) {
                        return;
                }
                // Fault message
                else if (exchange.getFault() != null) {
                        exchange.setStatus(ExchangeStatus.DONE);
                        channel.send(exchange);
                } else {
                        NormalizedMessage in =
exchange.getMessage("in");

                        if (in == null) {
                                // no in message - strange
                                throw new MessagingException(

"MyBean.onProviderExchange(): Exchange has no IN message");
                        } else {
                                String str =
(String)in.getProperty("INPUT_DATA");
                                NormalizedMessage out =
exchange.createMessage();

                                // set the content to dummy xml tag
                                out.setContent(new
StringSource("<payload/>"));
                                out.setProperty("OUTPUT_STRING",str );

                                exchange.setMessage(out, "out");
                                channel.send(exchange);

                        }
                }
        }
}

I hope this will give you fair idea about my problem. If needed any more
inputs let me know.
Hoping to see your response at the earliest.

Thanks,
Puneet



-----Original Message-----
From: Bruce Snyder [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 14, 2008 4:47 AM
To: [email protected]
Subject: Re: Urgent help required for the problem while running
servicemix sample with jboss and geronimo

On Feb 13, 2008 2:18 PM,  <[EMAIL PROTECTED]> wrote:
> Hi Bruce,
>
> Thanks for your reply.
> I tried adding targetEndpoint as you have mentioned. But it didn't
work.
> In my sample program bean component is getting called and the message
is
> coming perfectly in my bean. But I am not able to send back the
response
> that I set in my bean. I am setting the message in exchange object
with
> "out" key.

Please post the code from the MessageExchangeListener that you
implemented. If the message gets to the bean, then there must be
something missing in the onMessageExchange() method.

Bruce
--
perl -e 'print
unpack("u30","D0G)[EMAIL PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

Reply via email to