...
This examples relies on the WS-Notification component.
Launching the example
To run this example, open three terminals - one for each instance directory. In each terminal, start ServiceMix and feed the configuration like so:
In terminal one:
No Format |
---|
$ cd ./instance1
$ ../../../bin/servicemix ./servicemix1.xml
|
In terminal two:
No Format |
---|
$ cd ./instance2
$ ../../../bin/servicemix ./servicemix2.xml
|
In terminal three:
No Format |
---|
$ cd ./instance3
$ ../../../bin/servicemix ./servicemix3.xml
|
ServiceMix instance3 will publish messages to the topic named MyTopic and ServiceMix instance2 will receive these messages because it is subscribed to the topic named MyTopic.
The output of instance2 will look like:
No Format |
---|
INFO - TraceComponent - Exchange: InOnly[
id: ID:guillaumes-2995-1160038439984-8:4
status: Active
role: provider
endpoint: endpoint
in: <?xml version="1.0" encoding="UTF-8"?><ns2:Notify xmlns:ns2="http://docs.o
asis-open.org/wsn/b-2" xmlns="http://www.w3.org/2005/08/addressing" xmlns:ns3="h
ttp://docs.oasis-open.org/wsn/t-1" xmlns:ns4="http://docs.oasis-open.org/wsrf/bf
-2"><ns2:NotificationMessage><ns2:Topic>myTopic</ns2:Topic><ns2:Message><timer x
mlns="" xmlns:ns5="http://www.w3.org/2005/08/addressing"><name>My Example Job</n
ame><group>ServiceMix</group><fullname>ServiceMix.My Example Job</fullname><desc
ription/><fireTime>Thu Oct 05 10:54:32 CEST 2006</fireTime></timer></ns2:Message
></ns2:NotificationMessage></ns2:Notify>
] received IN message: org.apache.servicemix.jbi.messaging.NormalizedMessageImpl
@1298826{properties: {}}
|
Publisher side
Quartz component
Refer to Quartz for more informations.
Code Block | ||
---|---|---|
| ||
<sm:activationSpec destinationService="test:publisher" destinationEndpoint="endpoint"> <sm:component> <bean class="org.apache.servicemix.components.quartz.QuartzComponent"> <property name="triggers"> <map> <entry> <key> <bean class="org.quartz.SimpleTrigger"> <property name="repeatInterval" value="2000"/> <property name="repeatCount" value="20"/> </bean> </key> <bean class="org.quartz.JobDetail"> <property name="name" value="My Example Job"/> <property name="group" value="ServiceMix"/> </bean> </entry> </map> </property> </bean> </sm:component> </sm:activationSpec> |
...
The consumer
property indicates the JBI endpoint where exchanges must be sent to. The syntax used is:
No Format |
---|
namespace [SM30UG:sep] service [SM30UG:sep] endpoint |
where sep
is the separator used in the namespace uri: /
or :
.
In our case, the value
...