You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by jlo_gestalt <jl...@gestalt-llc.com> on 2006/08/03 17:16:33 UTC

SubscriptionSpec Expectations

In this thread, 
http://www.nabble.com/Capture-any-message-off-the-NMR--tf1902644.html
Capture any message off the NMR? , James.Strachan was helpful in providing
direction on how to retreive any message off the NMR. He offered two
suggestions which included using the servicemix audit package and the
publish/subscribe routing mechanism.
We have attempted both solutions without any luck. The publish/subscribe
looks very exciting.
First in order for you to not have to specify a service in the
<subscriptionSpec> tag, you have to checkout TRUNK and build SNAPSHOT. In
our test, we use a Ping Pong example (based off of the file-binding
example), where Ping creates a InOut MessageExchange, sends to Pong, and
Pong sets the Out Message and replies.

Here are our expectations:
1) Our subscriber should get notified when ping sends the message and when
pong replies.
2) The InOnly MessageExchange that is sent to the subscriber should have
information pertaining to the orignial source and destination service.

Here is what we have observed:
1) The subscriber only gets notified when ping sends the message, and not
when pong replies.
2) The InOnly MessageExchange that the subscriber receives has no
information about the original source and destination.

Our team wants to capture any message being sent over the NMR and map the to
and from of the message to services on a display page. Is the pub/sub
routing going to enable us to do this? Would it be possible to include
properties in the MessageExchange indicating the original source and
destination service?

Here is the content of our servicemix.xml file:

<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
         xmlns:foo="http://servicemix.org/demo">
         
  <classpath>
    <location>.</location>
  </classpath>

    <sm:serviceunit id="jbi">
        <sm:activationSpecs>
        
            <sm:activationSpec componentName="tracer" service="foo:tracer">
                <sm:component><bean class="pp.Tracer"/></sm:component>

                <!--  lets subscribe to the output of the foo:jmsReceiver
component -->
                <sm:subscriptions>
                    <sm:subscriptionSpec service="foo:ping"/>
                </sm:subscriptions>
            </sm:activationSpec>

            <!-- pong -->
            <sm:activationSpec componentName="pong" service="foo:pong">
                <sm:component>
                    <bean class="pp.Pong"/>
                </sm:component>
            </sm:activationSpec>

            <!-- ping -->
            <sm:activationSpec componentName="ping"
                destinationService="foo:pong" service="foo:ping">
                <sm:component>
                    <bean class="pp.Ping">
                        <property name="period" value="3000" />
                    </bean>
                </sm:component>
            </sm:activationSpec>
        </sm:activationSpecs>
    </sm:serviceunit>

</beans>
-- 
View this message in context: http://www.nabble.com/SubscriptionSpec-Expectations-tf2046265.html#a5634521
Sent from the ServiceMix - User forum at Nabble.com.


Re: SubscriptionSpec Expectations

Posted by jthorn721 <jt...@gmail.com>.
When I try what you suggest and add:                    
<sm:container>
   <sm:listeners>
      <bean class="pp.Trace"/>
   </sm:listeners>
</sm:container>

I get "Bean property 'container' is not writable or has an invalid setter
method."  Any thoughts what I'm doing wrong?  I also noticed in your post
you had <sm:container ...>  What needs to go where the ... is?
-- 
View this message in context: http://www.nabble.com/SubscriptionSpec-Expectations-tf2046265.html#a5653444
Sent from the ServiceMix - User forum at Nabble.com.


Re: SubscriptionSpec Expectations

Posted by Guillaume Nodet <gn...@gmail.com>.
Listener on the JBI container are not components.
You just need register the listener on the JBI container using the
addListener method.
You can do that programmatically, or in the configuration file, using the
following syntax:
   <sm:container ...>
    <sm:listeners>
      <bean class="your.bean.class" ... />
    <sm:listeners>
   </sm:container>
If you need to do that from a component, you can retrieve the JBIContainer
using
  ((ComponentContextImpl) getContext()).getContainer()
.

On 8/3/06, bruce76 <bh...@apress.com> wrote:
>
>
> Guillaume,
>
> So here's what we did (using ServiceMix 3):
>
> 1. We created two LW SEs (ping and pong)
> 2. Ping is the sender, but also extends AbstractAuditor (it also
> implements
> alot of the code that JdbcAuditor, but doesn't try to persist the data --
> it
> simply performs a System.out when exchangeSent() is called )
> 3. Ping sends several messages to pong, but Ping's  exchangeSent() method
> is
> never called
>
> Is this due to the fact that we're using LW components and not pure JBI
> components?
>
> Thanks,
>
> Bruce
> --
> View this message in context:
> http://www.nabble.com/SubscriptionSpec-Expectations-tf2046265.html#a5640041
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet

Re: SubscriptionSpec Expectations

Posted by bruce76 <bh...@apress.com>.
Guillaume,

So here's what we did (using ServiceMix 3):

1. We created two LW SEs (ping and pong)
2. Ping is the sender, but also extends AbstractAuditor (it also implements
alot of the code that JdbcAuditor, but doesn't try to persist the data -- it
simply performs a System.out when exchangeSent() is called )
3. Ping sends several messages to pong, but Ping's  exchangeSent() method is
never called

Is this due to the fact that we're using LW components and not pure JBI
components?

Thanks,

Bruce
-- 
View this message in context: http://www.nabble.com/SubscriptionSpec-Expectations-tf2046265.html#a5640041
Sent from the ServiceMix - User forum at Nabble.com.


Re: SubscriptionSpec Expectations

Posted by Guillaume Nodet <gn...@gmail.com>.
The publish / subscribe routing mechanism has been designed mainly for
InOnly meps.
What kind of problems did you experienced using listeners on the container ?

On 8/3/06, jlo_gestalt <jl...@gestalt-llc.com> wrote:
>
>
> In this thread,
> http://www.nabble.com/Capture-any-message-off-the-NMR--tf1902644.html
> Capture any message off the NMR? , James.Strachan was helpful in providing
> direction on how to retreive any message off the NMR. He offered two
> suggestions which included using the servicemix audit package and the
> publish/subscribe routing mechanism.
> We have attempted both solutions without any luck. The publish/subscribe
> looks very exciting.
> First in order for you to not have to specify a service in the
> <subscriptionSpec> tag, you have to checkout TRUNK and build SNAPSHOT. In
> our test, we use a Ping Pong example (based off of the file-binding
> example), where Ping creates a InOut MessageExchange, sends to Pong, and
> Pong sets the Out Message and replies.
>
> Here are our expectations:
> 1) Our subscriber should get notified when ping sends the message and when
> pong replies.
> 2) The InOnly MessageExchange that is sent to the subscriber should have
> information pertaining to the orignial source and destination service.
>
> Here is what we have observed:
> 1) The subscriber only gets notified when ping sends the message, and not
> when pong replies.
> 2) The InOnly MessageExchange that the subscriber receives has no
> information about the original source and destination.
>
> Our team wants to capture any message being sent over the NMR and map the
> to
> and from of the message to services on a display page. Is the pub/sub
> routing going to enable us to do this? Would it be possible to include
> properties in the MessageExchange indicating the original source and
> destination service?
>
> Here is the content of our servicemix.xml file:
>
> <beans xmlns:sm="http://servicemix.apache.org/config/1.0"
>          xmlns:foo="http://servicemix.org/demo">
>
>   <classpath>
>     <location>.</location>
>   </classpath>
>
>     <sm:serviceunit id="jbi">
>         <sm:activationSpecs>
>
>             <sm:activationSpec componentName="tracer"
> service="foo:tracer">
>                 <sm:component><bean class="pp.Tracer"/></sm:component>
>
>                 <!--  lets subscribe to the output of the foo:jmsReceiver
> component -->
>                 <sm:subscriptions>
>                     <sm:subscriptionSpec service="foo:ping"/>
>                 </sm:subscriptions>
>             </sm:activationSpec>
>
>             <!-- pong -->
>             <sm:activationSpec componentName="pong" service="foo:pong">
>                 <sm:component>
>                     <bean class="pp.Pong"/>
>                 </sm:component>
>             </sm:activationSpec>
>
>             <!-- ping -->
>             <sm:activationSpec componentName="ping"
>                 destinationService="foo:pong" service="foo:ping">
>                 <sm:component>
>                     <bean class="pp.Ping">
>                         <property name="period" value="3000" />
>                     </bean>
>                 </sm:component>
>             </sm:activationSpec>
>         </sm:activationSpecs>
>     </sm:serviceunit>
>
> </beans>
> --
> View this message in context:
> http://www.nabble.com/SubscriptionSpec-Expectations-tf2046265.html#a5634521
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet