You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by larsivi <la...@igesund.net> on 2006/08/25 11:36:01 UTC

Simple tracing

I'm just getting into using ESB/ServiceMix and as we most likely will need
custom services, I'm trying to get some simple messaging going, a POJO
listening to a socket, and when it receives a connection, it's supposed to
send a message to the NMR that preferably should be picked up by the trace
component.

My POJO-class is the MySender example with a ServerSocket added. This one
receives incoming socket connections, and answers them (this is working).
Before answering though, sendMessages is called and I would expect this to
be picked up by the trace component (and printed to the console).

my servicemix.xml has these parts:

        <sm:activationSpecs>

        <!-- START SNIPPET: simple test -->

            <sm:activationSpec componentName="tester" service="my:sender"
destinationService="my:trace">
                <sm:component>

                    <bean id="MySender" class="com.bar.foo.MySender">
                    </bean>
                 </sm:component>
            </sm:activationSpec>

            <!-- Route the event to a trace component that just outputs the
event to the console -->
            <sm:activationSpec componentName="trace" service="my:trace">
                <sm:component>
                    <bean
class="org.apache.servicemix.components.util.StreamWriterComponent" />
                </sm:component>
            </sm:activationSpec>
        </sm:activationSpecs>


So, it is far from obvious to me what I'm missing, whether I need more
components, or some other setup in the xml file, or more code in the
MySender example.

Thanks for any advice :)

Regards,
Lars Ivar Igesund
-- 
View this message in context: http://www.nabble.com/Simple-tracing-tf2163728.html#a5980329
Sent from the ServiceMix - User forum at Nabble.com.


Re: Simple tracing

Posted by larsivi <la...@igesund.net>.
I thought a log entry with Status: Done would indicate a successful message
exchange (at least this happens in the rss-test), and such I don't think the
exchange found it's target. I tried the sendSync method instead, and it
don't return. The last log message at this point is:

09:57:28,345 | DEBUG | main       | DeliveryChannelImpl      |
.messaging.DeliveryChannelImpl  703 | Waiting for exchange
ID:kubuntu-baerbar-35665-1156751760156-1:0 (45c97b) to be answered in
DeliveryChannel{tester} from sendSync

And since I've made sure that the socket don't reply until after this, there
no longer is an answer in the other end.

I tend to think that this is most likely a problem at my end, but wherever
it is, I am somewhat at a loss on how to debug. Btw, I use 3.0-M2

Thanks sofar,

Regards,
Lars Ivar Igesund


gnodet wrote:
> 
> The message is send asynchronously, so if your test stop immediately after
> receiving the
> response from the your tcp socket, the exchange may not have time to reach
> its destination.
> Try using a sendSync from your component to debug, but it seems the
> exchange
> has found its
> target, so it seems there is no problem.
> 
> On 8/25/06, larsivi <la...@igesund.net> wrote:
>>
>>
>> The console shows nothing afer the initial startup INFO messages. Going
>> into
>> the logfile, it's apparent that _something_ happens, but not everything.
>> I
>> have compared my logfile with the one created by the rss-binding example,
>> and whereas the rss-binding example's logfile shows several steps through
>> the chain and the exchange ends up with status Done, my test just seems
>> to
>> stop fairly quickly, the messages never reaching the trace component:
>> Here
>> is the logfile for one message (plus the end of the initialization), if I
>> send more messages, this behaviour is just duplicated and the only
>> difference being the content.
>>
>> 14:13:46,800 | DEBUG | main       | ComponentContextImpl     |
>> framework.ComponentContextImpl  133 | Component: trace activated
>> endpoint:
>> {http://servicemix.apache.org/demo/}trace : trace
>> 14:13:46,801 | DEBUG | main       | EndpointRegistry         |
>> jbi.framework.EndpointRegistry  239 | Endpoint
>> ServiceEndpoint[service={
>> http://servicemix.apache.org/demo/}trace,endpoint=trace]
>> has no service description
>> 14:13:49,495 | DEBUG | main       | DeliveryChannelImpl      |
>> .messaging.DeliveryChannelImpl  171 | default destination serviceName for
>> tester = {http://servicemix.apache.org/demo/}trace
>> 14:13:49,557 | DEBUG | main       | DeliveryChannelImpl      |
>> .messaging.DeliveryChannelImpl  404 | Send
>> ID:kubuntu-baerbar-53310-1156508026615-1:0 in DeliveryChannel{tester}
>> 14:13:49,679 | DEBUG | main       | DeliveryChannelImpl      |
>> .messaging.DeliveryChannelImpl  343 | Sent: MessageExchange[
>>   id: ID:kubuntu-baerbar-53310-1156508026615-1:0
>>   status: Active
>>   role: consumer
>>   service: {http://servicemix.apache.org/demo/}trace
>>   in: <?xml version="1.0" encoding="UTF-8"?><example id="457"/>
>> ]
>> 14:13:49,763 | DEBUG | main       | DefaultBroker            |
>> rvicemix.jbi.nmr.DefaultBroker  390 | Routing exchange MessageExchange[
>>   id: ID:kubuntu-baerbar-53310-1156508026615-1:0
>>   status: Active
>>   role: provider
>>   service: {http://servicemix.apache.org/demo/}trace
>>   endpoint: trace
>>   in: <?xml version="1.0" encoding="UTF-8"?><example id="457"/>
>> ] to:
>> ServiceEndpoint[service={
>> http://servicemix.apache.org/demo/}trace,endpoint=trace]
>> 14:13:49,764 | DEBUG | main       | SedaFlow                 |
>> emix.jbi.nmr.flow.AbstractFlow  115 | Called Flow send
>>
>> Thanks so far
>>
>> Regards Lars Ivar Igesund
>>
>>
>> gnodet wrote:
>> >
>> > If there is a problem, an exception should be thrown and logged
>> somewhere.
>> > Check the console and log files.
>> >
>> > On 8/25/06, larsivi <la...@igesund.net> wrote:
>> >>
>> >>
>> >> Yes, the exchange used is InOnly (I'm not too interested in the answer
>> >> yet,
>> >> as I'd rather like to get this working first, the socket connection
>> reply
>> >> is
>> >> currently equally much for testing, InOnly exchanges will most likely
>> be
>> >> a
>> >> common situation in the system, so getting it working won't be a waste
>> of
>> >> time.)
>> >>
>> >> The sendMessages method looks like this (copied verbatim from the
>> >> ServiceMix
>> >> source tree):
>> >>
>> >>     /**
>> >>      * Sends a number of messages
>> >>      */
>> >>     public void sendMessages(int count) throws MessagingException {
>> >>         DeliveryChannel deliveryChannel =
>> context.getDeliveryChannel();
>> >>         MessageExchangeFactory factory =
>> >> deliveryChannel.createExchangeFactory();
>> >>
>> >>         for (int i = 0; i < count; i++) {
>> >>             InOnly exchange = factory.createInOnlyExchange();
>> >>             NormalizedMessage message = exchange.createMessage();
>> >>             exchange.setInMessage(message);
>> >>
>> >>             message.setProperty("id", new Integer(i));
>> >>             message.setContent(new StringSource("<example id='" + i +
>> >> "'/>"));
>> >>
>> >>             deliveryChannel.send(exchange);
>> >>         }
>> >>     }
>> >>
>> >> Is it possible that the context (ComponentContext passed in the
>> >> ComponentLifeCycle.init method) is not the one "needed"?
>> >>
>> >> Thank you very much for you quick reply!
>> >>
>> >> Regards,
>> >> Lars Ivar Igesund
>> >>
>> >>
>> >>
>> >> gnodet wrote:
>> >> >
>> >> > You have to take care of the MEPs of the jbi exchanges.
>> >> > The trace component only supports InOnly meps, so if you
>> >> > want to use it, your component should send an InOnly exchange,
>> >> > else an exception should be thrown.
>> >> > But from your description, it seems you will need an InOut mep,
>> >> > so that your component will be able to return the answer back
>> >> > to the client.  In this case, you should send an InOut mep and
>> >> > use an EchoComponent instead (which will also output the
>> >> > exchange to the console).
>> >> >
>> >> > Your servicemix configuration looks good, so try to fix the
>> >> > above issues.
>> >> >
>> >> > On 8/25/06, larsivi <la...@igesund.net> wrote:
>> >> >>
>> >> >>
>> >> >> I'm just getting into using ESB/ServiceMix and as we most likely
>> will
>> >> >> need
>> >> >> custom services, I'm trying to get some simple messaging going, a
>> POJO
>> >> >> listening to a socket, and when it receives a connection, it's
>> >> supposed
>> >> >> to
>> >> >> send a message to the NMR that preferably should be picked up by
>> the
>> >> >> trace
>> >> >> component.
>> >> >>
>> >> >> My POJO-class is the MySender example with a ServerSocket added.
>> This
>> >> one
>> >> >> receives incoming socket connections, and answers them (this is
>> >> working).
>> >> >> Before answering though, sendMessages is called and I would expect
>> >> this
>> >> >> to
>> >> >> be picked up by the trace component (and printed to the console).
>> >> >>
>> >> >> my servicemix.xml has these parts:
>> >> >>
>> >> >>         <sm:activationSpecs>
>> >> >>
>> >> >>         <!-- START SNIPPET: simple test -->
>> >> >>
>> >> >>             <sm:activationSpec componentName="tester"
>> >> service="my:sender"
>> >> >> destinationService="my:trace">
>> >> >>                 <sm:component>
>> >> >>
>> >> >>                     <bean id="MySender" class="com.bar.foo.MySender
>> ">
>> >> >>                     </bean>
>> >> >>                  </sm:component>
>> >> >>             </sm:activationSpec>
>> >> >>
>> >> >>             <!-- Route the event to a trace component that just
>> >> outputs
>> >> >> the
>> >> >> event to the console -->
>> >> >>             <sm:activationSpec componentName="trace"
>> >> service="my:trace">
>> >> >>                 <sm:component>
>> >> >>                     <bean
>> >> >> class="org.apache.servicemix.components.util.StreamWriterComponent"
>> />
>> >> >>                 </sm:component>
>> >> >>             </sm:activationSpec>
>> >> >>         </sm:activationSpecs>
>> >> >>
>> >> >>
>> >> >> So, it is far from obvious to me what I'm missing, whether I need
>> more
>> >> >> components, or some other setup in the xml file, or more code in
>> the
>> >> >> MySender example.
>> >> >>
>> >> >> Thanks for any advice :)
>> >> >>
>> >> >> Regards,
>> >> >> Lars Ivar Igesund
>> >> >> --
>> >> >> View this message in context:
>> >> >> http://www.nabble.com/Simple-tracing-tf2163728.html#a5980329
>> >> >> Sent from the ServiceMix - User forum at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> > Cheers,
>> >> > Guillaume Nodet
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Simple-tracing-tf2163728.html#a5980729
>> >> Sent from the ServiceMix - User forum at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Simple-tracing-tf2163728.html#a5982388
>> Sent from the ServiceMix - User forum at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> 
> 

-- 
View this message in context: http://www.nabble.com/Simple-tracing-tf2163728.html#a6016071
Sent from the ServiceMix - User forum at Nabble.com.


Re: Simple tracing

Posted by Guillaume Nodet <gn...@gmail.com>.
The message is send asynchronously, so if your test stop immediately after
receiving the
response from the your tcp socket, the exchange may not have time to reach
its destination.
Try using a sendSync from your component to debug, but it seems the exchange
has found its
target, so it seems there is no problem.

On 8/25/06, larsivi <la...@igesund.net> wrote:
>
>
> The console shows nothing afer the initial startup INFO messages. Going
> into
> the logfile, it's apparent that _something_ happens, but not everything. I
> have compared my logfile with the one created by the rss-binding example,
> and whereas the rss-binding example's logfile shows several steps through
> the chain and the exchange ends up with status Done, my test just seems to
> stop fairly quickly, the messages never reaching the trace component: Here
> is the logfile for one message (plus the end of the initialization), if I
> send more messages, this behaviour is just duplicated and the only
> difference being the content.
>
> 14:13:46,800 | DEBUG | main       | ComponentContextImpl     |
> framework.ComponentContextImpl  133 | Component: trace activated endpoint:
> {http://servicemix.apache.org/demo/}trace : trace
> 14:13:46,801 | DEBUG | main       | EndpointRegistry         |
> jbi.framework.EndpointRegistry  239 | Endpoint
> ServiceEndpoint[service={
> http://servicemix.apache.org/demo/}trace,endpoint=trace]
> has no service description
> 14:13:49,495 | DEBUG | main       | DeliveryChannelImpl      |
> .messaging.DeliveryChannelImpl  171 | default destination serviceName for
> tester = {http://servicemix.apache.org/demo/}trace
> 14:13:49,557 | DEBUG | main       | DeliveryChannelImpl      |
> .messaging.DeliveryChannelImpl  404 | Send
> ID:kubuntu-baerbar-53310-1156508026615-1:0 in DeliveryChannel{tester}
> 14:13:49,679 | DEBUG | main       | DeliveryChannelImpl      |
> .messaging.DeliveryChannelImpl  343 | Sent: MessageExchange[
>   id: ID:kubuntu-baerbar-53310-1156508026615-1:0
>   status: Active
>   role: consumer
>   service: {http://servicemix.apache.org/demo/}trace
>   in: <?xml version="1.0" encoding="UTF-8"?><example id="457"/>
> ]
> 14:13:49,763 | DEBUG | main       | DefaultBroker            |
> rvicemix.jbi.nmr.DefaultBroker  390 | Routing exchange MessageExchange[
>   id: ID:kubuntu-baerbar-53310-1156508026615-1:0
>   status: Active
>   role: provider
>   service: {http://servicemix.apache.org/demo/}trace
>   endpoint: trace
>   in: <?xml version="1.0" encoding="UTF-8"?><example id="457"/>
> ] to:
> ServiceEndpoint[service={
> http://servicemix.apache.org/demo/}trace,endpoint=trace]
> 14:13:49,764 | DEBUG | main       | SedaFlow                 |
> emix.jbi.nmr.flow.AbstractFlow  115 | Called Flow send
>
> Thanks so far
>
> Regards Lars Ivar Igesund
>
>
> gnodet wrote:
> >
> > If there is a problem, an exception should be thrown and logged
> somewhere.
> > Check the console and log files.
> >
> > On 8/25/06, larsivi <la...@igesund.net> wrote:
> >>
> >>
> >> Yes, the exchange used is InOnly (I'm not too interested in the answer
> >> yet,
> >> as I'd rather like to get this working first, the socket connection
> reply
> >> is
> >> currently equally much for testing, InOnly exchanges will most likely
> be
> >> a
> >> common situation in the system, so getting it working won't be a waste
> of
> >> time.)
> >>
> >> The sendMessages method looks like this (copied verbatim from the
> >> ServiceMix
> >> source tree):
> >>
> >>     /**
> >>      * Sends a number of messages
> >>      */
> >>     public void sendMessages(int count) throws MessagingException {
> >>         DeliveryChannel deliveryChannel = context.getDeliveryChannel();
> >>         MessageExchangeFactory factory =
> >> deliveryChannel.createExchangeFactory();
> >>
> >>         for (int i = 0; i < count; i++) {
> >>             InOnly exchange = factory.createInOnlyExchange();
> >>             NormalizedMessage message = exchange.createMessage();
> >>             exchange.setInMessage(message);
> >>
> >>             message.setProperty("id", new Integer(i));
> >>             message.setContent(new StringSource("<example id='" + i +
> >> "'/>"));
> >>
> >>             deliveryChannel.send(exchange);
> >>         }
> >>     }
> >>
> >> Is it possible that the context (ComponentContext passed in the
> >> ComponentLifeCycle.init method) is not the one "needed"?
> >>
> >> Thank you very much for you quick reply!
> >>
> >> Regards,
> >> Lars Ivar Igesund
> >>
> >>
> >>
> >> gnodet wrote:
> >> >
> >> > You have to take care of the MEPs of the jbi exchanges.
> >> > The trace component only supports InOnly meps, so if you
> >> > want to use it, your component should send an InOnly exchange,
> >> > else an exception should be thrown.
> >> > But from your description, it seems you will need an InOut mep,
> >> > so that your component will be able to return the answer back
> >> > to the client.  In this case, you should send an InOut mep and
> >> > use an EchoComponent instead (which will also output the
> >> > exchange to the console).
> >> >
> >> > Your servicemix configuration looks good, so try to fix the
> >> > above issues.
> >> >
> >> > On 8/25/06, larsivi <la...@igesund.net> wrote:
> >> >>
> >> >>
> >> >> I'm just getting into using ESB/ServiceMix and as we most likely
> will
> >> >> need
> >> >> custom services, I'm trying to get some simple messaging going, a
> POJO
> >> >> listening to a socket, and when it receives a connection, it's
> >> supposed
> >> >> to
> >> >> send a message to the NMR that preferably should be picked up by the
> >> >> trace
> >> >> component.
> >> >>
> >> >> My POJO-class is the MySender example with a ServerSocket added.
> This
> >> one
> >> >> receives incoming socket connections, and answers them (this is
> >> working).
> >> >> Before answering though, sendMessages is called and I would expect
> >> this
> >> >> to
> >> >> be picked up by the trace component (and printed to the console).
> >> >>
> >> >> my servicemix.xml has these parts:
> >> >>
> >> >>         <sm:activationSpecs>
> >> >>
> >> >>         <!-- START SNIPPET: simple test -->
> >> >>
> >> >>             <sm:activationSpec componentName="tester"
> >> service="my:sender"
> >> >> destinationService="my:trace">
> >> >>                 <sm:component>
> >> >>
> >> >>                     <bean id="MySender" class="com.bar.foo.MySender
> ">
> >> >>                     </bean>
> >> >>                  </sm:component>
> >> >>             </sm:activationSpec>
> >> >>
> >> >>             <!-- Route the event to a trace component that just
> >> outputs
> >> >> the
> >> >> event to the console -->
> >> >>             <sm:activationSpec componentName="trace"
> >> service="my:trace">
> >> >>                 <sm:component>
> >> >>                     <bean
> >> >> class="org.apache.servicemix.components.util.StreamWriterComponent"
> />
> >> >>                 </sm:component>
> >> >>             </sm:activationSpec>
> >> >>         </sm:activationSpecs>
> >> >>
> >> >>
> >> >> So, it is far from obvious to me what I'm missing, whether I need
> more
> >> >> components, or some other setup in the xml file, or more code in the
> >> >> MySender example.
> >> >>
> >> >> Thanks for any advice :)
> >> >>
> >> >> Regards,
> >> >> Lars Ivar Igesund
> >> >> --
> >> >> View this message in context:
> >> >> http://www.nabble.com/Simple-tracing-tf2163728.html#a5980329
> >> >> Sent from the ServiceMix - User forum at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Cheers,
> >> > Guillaume Nodet
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Simple-tracing-tf2163728.html#a5980729
> >> Sent from the ServiceMix - User forum at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Simple-tracing-tf2163728.html#a5982388
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet

Re: Simple tracing

Posted by larsivi <la...@igesund.net>.
The console shows nothing afer the initial startup INFO messages. Going into
the logfile, it's apparent that _something_ happens, but not everything. I
have compared my logfile with the one created by the rss-binding example,
and whereas the rss-binding example's logfile shows several steps through
the chain and the exchange ends up with status Done, my test just seems to
stop fairly quickly, the messages never reaching the trace component: Here
is the logfile for one message (plus the end of the initialization), if I
send more messages, this behaviour is just duplicated and the only
difference being the content.

14:13:46,800 | DEBUG | main       | ComponentContextImpl     |
framework.ComponentContextImpl  133 | Component: trace activated endpoint:
{http://servicemix.apache.org/demo/}trace : trace
14:13:46,801 | DEBUG | main       | EndpointRegistry         |
jbi.framework.EndpointRegistry  239 | Endpoint
ServiceEndpoint[service={http://servicemix.apache.org/demo/}trace,endpoint=trace]
has no service description
14:13:49,495 | DEBUG | main       | DeliveryChannelImpl      |
.messaging.DeliveryChannelImpl  171 | default destination serviceName for
tester = {http://servicemix.apache.org/demo/}trace
14:13:49,557 | DEBUG | main       | DeliveryChannelImpl      |
.messaging.DeliveryChannelImpl  404 | Send
ID:kubuntu-baerbar-53310-1156508026615-1:0 in DeliveryChannel{tester}
14:13:49,679 | DEBUG | main       | DeliveryChannelImpl      |
.messaging.DeliveryChannelImpl  343 | Sent: MessageExchange[
  id: ID:kubuntu-baerbar-53310-1156508026615-1:0
  status: Active
  role: consumer
  service: {http://servicemix.apache.org/demo/}trace
  in: <?xml version="1.0" encoding="UTF-8"?><example id="457"/>
]
14:13:49,763 | DEBUG | main       | DefaultBroker            |
rvicemix.jbi.nmr.DefaultBroker  390 | Routing exchange MessageExchange[
  id: ID:kubuntu-baerbar-53310-1156508026615-1:0
  status: Active
  role: provider
  service: {http://servicemix.apache.org/demo/}trace
  endpoint: trace
  in: <?xml version="1.0" encoding="UTF-8"?><example id="457"/>
] to:
ServiceEndpoint[service={http://servicemix.apache.org/demo/}trace,endpoint=trace]
14:13:49,764 | DEBUG | main       | SedaFlow                 |
emix.jbi.nmr.flow.AbstractFlow  115 | Called Flow send

Thanks so far

Regards Lars Ivar Igesund


gnodet wrote:
> 
> If there is a problem, an exception should be thrown and logged somewhere.
> Check the console and log files.
> 
> On 8/25/06, larsivi <la...@igesund.net> wrote:
>>
>>
>> Yes, the exchange used is InOnly (I'm not too interested in the answer
>> yet,
>> as I'd rather like to get this working first, the socket connection reply
>> is
>> currently equally much for testing, InOnly exchanges will most likely be
>> a
>> common situation in the system, so getting it working won't be a waste of
>> time.)
>>
>> The sendMessages method looks like this (copied verbatim from the
>> ServiceMix
>> source tree):
>>
>>     /**
>>      * Sends a number of messages
>>      */
>>     public void sendMessages(int count) throws MessagingException {
>>         DeliveryChannel deliveryChannel = context.getDeliveryChannel();
>>         MessageExchangeFactory factory =
>> deliveryChannel.createExchangeFactory();
>>
>>         for (int i = 0; i < count; i++) {
>>             InOnly exchange = factory.createInOnlyExchange();
>>             NormalizedMessage message = exchange.createMessage();
>>             exchange.setInMessage(message);
>>
>>             message.setProperty("id", new Integer(i));
>>             message.setContent(new StringSource("<example id='" + i +
>> "'/>"));
>>
>>             deliveryChannel.send(exchange);
>>         }
>>     }
>>
>> Is it possible that the context (ComponentContext passed in the
>> ComponentLifeCycle.init method) is not the one "needed"?
>>
>> Thank you very much for you quick reply!
>>
>> Regards,
>> Lars Ivar Igesund
>>
>>
>>
>> gnodet wrote:
>> >
>> > You have to take care of the MEPs of the jbi exchanges.
>> > The trace component only supports InOnly meps, so if you
>> > want to use it, your component should send an InOnly exchange,
>> > else an exception should be thrown.
>> > But from your description, it seems you will need an InOut mep,
>> > so that your component will be able to return the answer back
>> > to the client.  In this case, you should send an InOut mep and
>> > use an EchoComponent instead (which will also output the
>> > exchange to the console).
>> >
>> > Your servicemix configuration looks good, so try to fix the
>> > above issues.
>> >
>> > On 8/25/06, larsivi <la...@igesund.net> wrote:
>> >>
>> >>
>> >> I'm just getting into using ESB/ServiceMix and as we most likely will
>> >> need
>> >> custom services, I'm trying to get some simple messaging going, a POJO
>> >> listening to a socket, and when it receives a connection, it's
>> supposed
>> >> to
>> >> send a message to the NMR that preferably should be picked up by the
>> >> trace
>> >> component.
>> >>
>> >> My POJO-class is the MySender example with a ServerSocket added. This
>> one
>> >> receives incoming socket connections, and answers them (this is
>> working).
>> >> Before answering though, sendMessages is called and I would expect
>> this
>> >> to
>> >> be picked up by the trace component (and printed to the console).
>> >>
>> >> my servicemix.xml has these parts:
>> >>
>> >>         <sm:activationSpecs>
>> >>
>> >>         <!-- START SNIPPET: simple test -->
>> >>
>> >>             <sm:activationSpec componentName="tester"
>> service="my:sender"
>> >> destinationService="my:trace">
>> >>                 <sm:component>
>> >>
>> >>                     <bean id="MySender" class="com.bar.foo.MySender">
>> >>                     </bean>
>> >>                  </sm:component>
>> >>             </sm:activationSpec>
>> >>
>> >>             <!-- Route the event to a trace component that just
>> outputs
>> >> the
>> >> event to the console -->
>> >>             <sm:activationSpec componentName="trace"
>> service="my:trace">
>> >>                 <sm:component>
>> >>                     <bean
>> >> class="org.apache.servicemix.components.util.StreamWriterComponent" />
>> >>                 </sm:component>
>> >>             </sm:activationSpec>
>> >>         </sm:activationSpecs>
>> >>
>> >>
>> >> So, it is far from obvious to me what I'm missing, whether I need more
>> >> components, or some other setup in the xml file, or more code in the
>> >> MySender example.
>> >>
>> >> Thanks for any advice :)
>> >>
>> >> Regards,
>> >> Lars Ivar Igesund
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Simple-tracing-tf2163728.html#a5980329
>> >> Sent from the ServiceMix - User forum at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Cheers,
>> > Guillaume Nodet
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Simple-tracing-tf2163728.html#a5980729
>> Sent from the ServiceMix - User forum at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> 
> 

-- 
View this message in context: http://www.nabble.com/Simple-tracing-tf2163728.html#a5982388
Sent from the ServiceMix - User forum at Nabble.com.


Re: Simple tracing

Posted by Guillaume Nodet <gn...@gmail.com>.
If there is a problem, an exception should be thrown and logged somewhere.
Check the console and log files.

On 8/25/06, larsivi <la...@igesund.net> wrote:
>
>
> Yes, the exchange used is InOnly (I'm not too interested in the answer
> yet,
> as I'd rather like to get this working first, the socket connection reply
> is
> currently equally much for testing, InOnly exchanges will most likely be a
> common situation in the system, so getting it working won't be a waste of
> time.)
>
> The sendMessages method looks like this (copied verbatim from the
> ServiceMix
> source tree):
>
>     /**
>      * Sends a number of messages
>      */
>     public void sendMessages(int count) throws MessagingException {
>         DeliveryChannel deliveryChannel = context.getDeliveryChannel();
>         MessageExchangeFactory factory =
> deliveryChannel.createExchangeFactory();
>
>         for (int i = 0; i < count; i++) {
>             InOnly exchange = factory.createInOnlyExchange();
>             NormalizedMessage message = exchange.createMessage();
>             exchange.setInMessage(message);
>
>             message.setProperty("id", new Integer(i));
>             message.setContent(new StringSource("<example id='" + i +
> "'/>"));
>
>             deliveryChannel.send(exchange);
>         }
>     }
>
> Is it possible that the context (ComponentContext passed in the
> ComponentLifeCycle.init method) is not the one "needed"?
>
> Thank you very much for you quick reply!
>
> Regards,
> Lars Ivar Igesund
>
>
>
> gnodet wrote:
> >
> > You have to take care of the MEPs of the jbi exchanges.
> > The trace component only supports InOnly meps, so if you
> > want to use it, your component should send an InOnly exchange,
> > else an exception should be thrown.
> > But from your description, it seems you will need an InOut mep,
> > so that your component will be able to return the answer back
> > to the client.  In this case, you should send an InOut mep and
> > use an EchoComponent instead (which will also output the
> > exchange to the console).
> >
> > Your servicemix configuration looks good, so try to fix the
> > above issues.
> >
> > On 8/25/06, larsivi <la...@igesund.net> wrote:
> >>
> >>
> >> I'm just getting into using ESB/ServiceMix and as we most likely will
> >> need
> >> custom services, I'm trying to get some simple messaging going, a POJO
> >> listening to a socket, and when it receives a connection, it's supposed
> >> to
> >> send a message to the NMR that preferably should be picked up by the
> >> trace
> >> component.
> >>
> >> My POJO-class is the MySender example with a ServerSocket added. This
> one
> >> receives incoming socket connections, and answers them (this is
> working).
> >> Before answering though, sendMessages is called and I would expect this
> >> to
> >> be picked up by the trace component (and printed to the console).
> >>
> >> my servicemix.xml has these parts:
> >>
> >>         <sm:activationSpecs>
> >>
> >>         <!-- START SNIPPET: simple test -->
> >>
> >>             <sm:activationSpec componentName="tester"
> service="my:sender"
> >> destinationService="my:trace">
> >>                 <sm:component>
> >>
> >>                     <bean id="MySender" class="com.bar.foo.MySender">
> >>                     </bean>
> >>                  </sm:component>
> >>             </sm:activationSpec>
> >>
> >>             <!-- Route the event to a trace component that just outputs
> >> the
> >> event to the console -->
> >>             <sm:activationSpec componentName="trace"
> service="my:trace">
> >>                 <sm:component>
> >>                     <bean
> >> class="org.apache.servicemix.components.util.StreamWriterComponent" />
> >>                 </sm:component>
> >>             </sm:activationSpec>
> >>         </sm:activationSpecs>
> >>
> >>
> >> So, it is far from obvious to me what I'm missing, whether I need more
> >> components, or some other setup in the xml file, or more code in the
> >> MySender example.
> >>
> >> Thanks for any advice :)
> >>
> >> Regards,
> >> Lars Ivar Igesund
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Simple-tracing-tf2163728.html#a5980329
> >> Sent from the ServiceMix - User forum at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Simple-tracing-tf2163728.html#a5980729
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet

Re: Simple tracing

Posted by larsivi <la...@igesund.net>.
Yes, the exchange used is InOnly (I'm not too interested in the answer yet,
as I'd rather like to get this working first, the socket connection reply is
currently equally much for testing, InOnly exchanges will most likely be a
common situation in the system, so getting it working won't be a waste of
time.)

The sendMessages method looks like this (copied verbatim from the ServiceMix
source tree):

    /**
     * Sends a number of messages
     */
    public void sendMessages(int count) throws MessagingException {
        DeliveryChannel deliveryChannel = context.getDeliveryChannel();
        MessageExchangeFactory factory =
deliveryChannel.createExchangeFactory();

        for (int i = 0; i < count; i++) {
            InOnly exchange = factory.createInOnlyExchange();
            NormalizedMessage message = exchange.createMessage();
            exchange.setInMessage(message);

            message.setProperty("id", new Integer(i));
            message.setContent(new StringSource("<example id='" + i +
"'/>"));

            deliveryChannel.send(exchange);
        }
    }

Is it possible that the context (ComponentContext passed in the
ComponentLifeCycle.init method) is not the one "needed"?

Thank you very much for you quick reply!

Regards,
Lars Ivar Igesund



gnodet wrote:
> 
> You have to take care of the MEPs of the jbi exchanges.
> The trace component only supports InOnly meps, so if you
> want to use it, your component should send an InOnly exchange,
> else an exception should be thrown.
> But from your description, it seems you will need an InOut mep,
> so that your component will be able to return the answer back
> to the client.  In this case, you should send an InOut mep and
> use an EchoComponent instead (which will also output the
> exchange to the console).
> 
> Your servicemix configuration looks good, so try to fix the
> above issues.
> 
> On 8/25/06, larsivi <la...@igesund.net> wrote:
>>
>>
>> I'm just getting into using ESB/ServiceMix and as we most likely will
>> need
>> custom services, I'm trying to get some simple messaging going, a POJO
>> listening to a socket, and when it receives a connection, it's supposed
>> to
>> send a message to the NMR that preferably should be picked up by the
>> trace
>> component.
>>
>> My POJO-class is the MySender example with a ServerSocket added. This one
>> receives incoming socket connections, and answers them (this is working).
>> Before answering though, sendMessages is called and I would expect this
>> to
>> be picked up by the trace component (and printed to the console).
>>
>> my servicemix.xml has these parts:
>>
>>         <sm:activationSpecs>
>>
>>         <!-- START SNIPPET: simple test -->
>>
>>             <sm:activationSpec componentName="tester" service="my:sender"
>> destinationService="my:trace">
>>                 <sm:component>
>>
>>                     <bean id="MySender" class="com.bar.foo.MySender">
>>                     </bean>
>>                  </sm:component>
>>             </sm:activationSpec>
>>
>>             <!-- Route the event to a trace component that just outputs
>> the
>> event to the console -->
>>             <sm:activationSpec componentName="trace" service="my:trace">
>>                 <sm:component>
>>                     <bean
>> class="org.apache.servicemix.components.util.StreamWriterComponent" />
>>                 </sm:component>
>>             </sm:activationSpec>
>>         </sm:activationSpecs>
>>
>>
>> So, it is far from obvious to me what I'm missing, whether I need more
>> components, or some other setup in the xml file, or more code in the
>> MySender example.
>>
>> Thanks for any advice :)
>>
>> Regards,
>> Lars Ivar Igesund
>> --
>> View this message in context:
>> http://www.nabble.com/Simple-tracing-tf2163728.html#a5980329
>> Sent from the ServiceMix - User forum at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Guillaume Nodet
> 
> 

-- 
View this message in context: http://www.nabble.com/Simple-tracing-tf2163728.html#a5980729
Sent from the ServiceMix - User forum at Nabble.com.


Re: Simple tracing

Posted by Guillaume Nodet <gn...@gmail.com>.
You have to take care of the MEPs of the jbi exchanges.
The trace component only supports InOnly meps, so if you
want to use it, your component should send an InOnly exchange,
else an exception should be thrown.
But from your description, it seems you will need an InOut mep,
so that your component will be able to return the answer back
to the client.  In this case, you should send an InOut mep and
use an EchoComponent instead (which will also output the
exchange to the console).

Your servicemix configuration looks good, so try to fix the
above issues.

On 8/25/06, larsivi <la...@igesund.net> wrote:
>
>
> I'm just getting into using ESB/ServiceMix and as we most likely will need
> custom services, I'm trying to get some simple messaging going, a POJO
> listening to a socket, and when it receives a connection, it's supposed to
> send a message to the NMR that preferably should be picked up by the trace
> component.
>
> My POJO-class is the MySender example with a ServerSocket added. This one
> receives incoming socket connections, and answers them (this is working).
> Before answering though, sendMessages is called and I would expect this to
> be picked up by the trace component (and printed to the console).
>
> my servicemix.xml has these parts:
>
>         <sm:activationSpecs>
>
>         <!-- START SNIPPET: simple test -->
>
>             <sm:activationSpec componentName="tester" service="my:sender"
> destinationService="my:trace">
>                 <sm:component>
>
>                     <bean id="MySender" class="com.bar.foo.MySender">
>                     </bean>
>                  </sm:component>
>             </sm:activationSpec>
>
>             <!-- Route the event to a trace component that just outputs
> the
> event to the console -->
>             <sm:activationSpec componentName="trace" service="my:trace">
>                 <sm:component>
>                     <bean
> class="org.apache.servicemix.components.util.StreamWriterComponent" />
>                 </sm:component>
>             </sm:activationSpec>
>         </sm:activationSpecs>
>
>
> So, it is far from obvious to me what I'm missing, whether I need more
> components, or some other setup in the xml file, or more code in the
> MySender example.
>
> Thanks for any advice :)
>
> Regards,
> Lars Ivar Igesund
> --
> View this message in context:
> http://www.nabble.com/Simple-tracing-tf2163728.html#a5980329
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet