Thanks  a lot Guillaume. I was checking under the condition that source
!=null and that was creating the wrong results. I have used it as
mentioned by you. 

I don't intend to use the exchange id other than reference but is there
any meaning to way it is generated in servicemix 

Ex: Phantom-2254-1158201624312-16:1

<machine_name>-<?>-<timestamp>-<?>:<?> 

Regards 
Kiran


-----Original Message-----
From: Guillaume Nodet [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 13, 2006 3:31 PM
To: [email protected]
Subject: Re: Questions about JDBCAuditor and JBIContainer

First, you have to keep in mind that a jbi exchange is not
sent by an endpoint, but by a component.  Thus, there is
no notion of "sender endpoint".

So if you use exchange.getSourceId().getName(),
it should always return the component name, be it
a lightweight component or a standard jbi component.
"servicemix-http" seems fine in this case.

You can take a look at the
org.apache.servicemix.jbi.view.DotViewFlowListener
that is used to draw some visualisation [1].
It uses the following code snippet:

            MessageExchangeImpl mei = (MessageExchangeImpl) me;
            String source = (String)
me.getProperty(JbiConstants.SENDER_ENDPOINT);
            if (source == null) {
                source = mei.getSourceId().getName();
            }

[1] http://servicemix.goopen.org/site/visualisation.html

On 9/14/06, Kiran Addepalli - SECF <[EMAIL PROTECTED]> wrote:
> Hi
>
> A follow up on the question on message exchange listener.
>
> To get the name of the source component, I am using
>
>  ((MessageExchangeImpl)exchange).getSourceId().getName()
>
> But it returns the "servicemix-http" and not the actual name of the
> component.  For any light-weight components the getName() returns
NULL.
>
> I would like to get the service and endpoint name specified in my
> xbean.xml or servicemix.xml for source of a message.
>
> I also tried to getSourceContext().getComponentName() with the same
> result.
>
> Should I be doing something different?
>
> Regards
> Kiran
>
>
> -----Original Message-----
> From: Guillaume Nodet [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 03, 2006 12:33 PM
> To: [email protected]
> Subject: Re: Questions about JDBCAuditor and JBIContainer
>
> From the component, in the init method, you can use
>    ((ComponentContextImpl) getContext()).getContainer()
>
> On 8/4/06, Kiran Addepalli - SECF <[EMAIL PROTECTED]> wrote:
> >
> > Hi
> >
> > I am doing a similar implementation and this thread has helped a
lot.
> I
> > would like to deploy this as a service assembly. Is there a way to
get
> > the JBIcontainer reference in the serviceunit ?
> >
> > Deploying the serviceunit/assembly results in
> > PropertyAccessExceptionsException (1 errors)
> > org.springframework.beans.TypeMismatchException: Failed to convert
> > property value of type
> > [org.apache.servicemix.jbi.container.SpringServiceUnitContainer] to
> > required type [org.apache.servicemix.jbi.container.JBIContainer] for
> > property 'container'
> >
> > My serviceunit descriptor is below
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://xbean.org/schemas/spring/1.0";
> >         xmlns:sm="http://servicemix.apache.org/config/1.0";
> >         xmlns:my="http://test.com";
> > >
> >   <classpath>
> >     <location>.</location>
> >   </classpath>
> >         <sm:serviceunit id="jbi">
> >                 <sm:activationSpecs>
> >                 <sm:activationSpec
componentName="messageFlowListener"
> > service="my:messageFlowListener">
> >                         <sm:component>
> >                                 <bean class="my.MessageFlowListener"
>
> >                                         <property name="container"
> > ref="jbi"/>
> >                                 </bean>
> >                         </sm:component>
> >                 </sm:activationSpec>
> >                 </sm:activationSpecs>
> >         </sm:serviceunit>
> > </beans>
> >
> >
> > Regards
> > Kiran
> >
> > -----Original Message-----
> > From: Guillaume Nodet [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, August 02, 2006 9:44 AM
> > To: [email protected]
> > Subject: Re: Questions about JDBCAuditor and JBIContainer
> >
> > On 8/2/06, bruce76 <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > Hi,
> > >
> > > We're planning on creating a display that shows all the messages
> > flowing
> > > in
> > > and out of the NMR (I realize that this is a continuation of the
> "Get
> > all
> > > messages off the NMR thread")
> > >
> > >
> http://www.nabble.com/Capture-any-message-off-the-NMR--tf1902644.html
> > >
> > > However, we want to explore the path of using either the
JDBCAuditor
> > or
> > > the
> > > JBIContainer objects. So, here's my questions:
> > >
> > > 1. If I use the JBIContainter.addListener(listener), should I get
a
> > > callback
> > > on every MessageExchange flowing through the NMR?
> >
> >
> > Yes.  Every time  a JBI exchange is sent by a component using
> > DeliveryChannel.send or DeliveryChannel.sendSync, the listener
> > is called with the given exchange.
> >
> > 2. If so, then is it possible to obtain the "sender" of the message?
I
> > > realize that I can determine the recipient of message from using
> > either
> > > MessageExchange.getEndpoint()  or  MessageExchange.getService()
> >
> >
> > Sure.
> > You should find the code in one of the existing listeners at
> >
>
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/
> > src/main/java/org/apache/servicemix/jbi/view/
> > Somehting like
> >    ((MessageExchangeImpl) exchange).getSourceId()
> > will return an identifier of the component that sent the exchange.
> >
> > Thanks,
> > >
> > > Bruce
> > > --
> > > View this message in context:
> > >
> >
>
http://www.nabble.com/Questions-about-JDBCAuditor-and-JBIContainer-tf204
> > 0547.html#a5616242
> > > Sent from the ServiceMix - User forum at Nabble.com.
> > >
> > >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> > ***************************************************************
> > The information in this email is confidential and may be
> > legally privileged. It is intended solely for the addressee. If
> > you have received this communication in error, please contact
> > the sender immediately, return the original message to the
> > sender, and delete the material from your computer.  Thank you.
> > ***************************************************************
> >
>
>
>
> --
> Cheers,
> Guillaume Nodet
>
>
>


-- 
Cheers,
Guillaume Nodet

Reply via email to