Author: chirino
Date: Mon Sep 11 06:01:04 2006
New Revision: 442207
URL: http://svn.apache.org/viewvc?view=rev&rev=442207
Log:
Latest export from confluence
Modified:
incubator/servicemix/site/sm30ug/servicemix-wsn2005.html
Modified: incubator/servicemix/site/sm30ug/servicemix-wsn2005.html
URL:
http://svn.apache.org/viewvc/incubator/servicemix/site/sm30ug/servicemix-wsn2005.html?view=diff&rev=442207&r1=442206&r2=442207
==============================================================================
--- incubator/servicemix/site/sm30ug/servicemix-wsn2005.html (original)
+++ incubator/servicemix/site/sm30ug/servicemix-wsn2005.html Mon Sep 11
06:01:04 2006
@@ -47,28 +47,201 @@
</UL>
+<P>The current implementation has several limitations:</P>
+<UL>
+ <LI>subscriptions are not persistent: message will be lost if the
subscriber can not be reached</LI>
+ <LI>subscriptions can not be clustered: if you register the same
subscriber in a cluster, each node will receive all notifications</LI>
+ <LI>publishing can not be restricted to registered publishers: everyone
can publish through an anonymous publisher</LI>
+</UL>
+
+
<H2><A name="servicemix-wsn2005-Usagescenarii"></A>Usage scenarii</H2>
<P>The WS-Notification SE can be used to provide publish/subscribe routing in
the JBI bus. There are several usage:</P>
<UL>
<LI><A href="#servicemix-wsn2005-ConfigurationusingJBIpackaging"
title="Configuration using JBI packaging on servicemix-wsn2005">configuration
using JBI packaging</A></LI>
<LI><A href="#servicemix-wsn2005-DynamicconfigurationinsidetheJBIbus"
title="Dynamic configuration inside the JBI bus on servicemix-wsn2005">dynamic
configuration inside the JBI bus</A></LI>
- <LI><A href="#servicemix-wsn2005-OutsidetheJBIbus" title="Outside the
JBI bus on servicemix-wsn2005">Outside the JBI bus</A></LI>
+ <LI><A href="#servicemix-wsn2005-OutsidetheJBIbus" title="Outside the
JBI bus on servicemix-wsn2005">outside the JBI bus</A></LI>
<LI><A href="#servicemix-wsn2005-EmbeddingWSNotification"
title="Embedding WS-Notification on servicemix-wsn2005">embedding
WS-Notification SE</A></LI>
</UL>
-<H2><A
name="servicemix-wsn2005-ConfigurationusingJBIpackaging"></A>Configuration
using JBI packaging</H2>
+<H3><A
name="servicemix-wsn2005-ConfigurationusingJBIpackaging"></A>Configuration
using JBI packaging</H3>
+
+<P>The <TT>servicemix-wsn2005</TT> accepts deployment of Service Units.<BR>
+The SU must contain one or more files with an xml extension, each one
containing a single WS-Notification request. The currently supported set of
requests include:</P>
+<UL>
+ <LI><A href="#servicemix-wsn2005-Subscribe" title="Subscribe on
servicemix-wsn2005">Subscribe</A></LI>
+ <LI><A href="#servicemix-wsn2005-CreatePullPoint"
title="CreatePullPoint on servicemix-wsn2005">CreatePullPoint</A></LI>
+</UL>
+
+
+<P>The requests will be started in this very order, so that you can create a
PullPoint and create a Subscription for it inside the same service unit.</P>
-<H2><A
name="servicemix-wsn2005-DynamicconfigurationinsidetheJBIbus"></A>Dynamic
configuration inside the JBI bus</H2>
+<H3><A
name="servicemix-wsn2005-DynamicconfigurationinsidetheJBIbus"></A>Dynamic
configuration inside the JBI bus</H3>
-<H2><A name="servicemix-wsn2005-OutsidetheJBIbus"></A>Outside the JBI bus</H2>
+<P>In addition to the deployment of service units, you can also create pull
points or subscriptions dynamically from inside the JBI bus by using a simple
API.</P>
-<P>If you want to use WS-Notification ouside the JBI world, you will need to
be able to receive incoming requests or send notifications to the external
services. This must be done through by using Binding Components, either using
HTTP or JMS.</P>
+<P>To create a subscription for a given JBI endpoint, you can use the
following code:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">QName service = ...;
+<SPAN class="code-object">String</SPAN> endpoint = ...;
+<SPAN class="code-object">String</SPAN> topic = ...;
+NotificationBroker wsnBroker = <SPAN class="code-keyword">new</SPAN>
NotificationBroker(getContext());
+EndpointReferenceType consumer = <SPAN class="code-keyword">new</SPAN>
EndpointReferenceType();
+consumer.setAddress(<SPAN class="code-keyword">new</SPAN> AttributedURIType());
+consumer.getAddress().setValue(service.getNamespaceURI() + <SPAN
class="code-quote">"/"</SPAN> + service.getLocalPart() + <SPAN
class="code-quote">"/"</SPAN> + endpoint);
+wsnBroker.subscribe(consumer, topic);</PRE>
+</DIV></DIV>
+
+<P>To publish a message on a given topic:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-object">String</SPAN> topic = ...;
+NotificationBroker wsnBroker = <SPAN class="code-keyword">new</SPAN>
NotificationBroker(getContext());
+wsnBroker.notify(topic, message);</PRE>
+</DIV></DIV>
+<P>where <TT>message</TT> is a DOM element.</P>
+
+<P>You can also create pull points and subscriptions for them:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">CreatePullPoint wsnCreatePullPoint = <SPAN
class="code-keyword">new</SPAN> CreatePullPoint(getContext());
+PullPoint pullPoint = wsnCreatePullPoint.createPullPoint();
+NotificationBroker wsnBroker = <SPAN class="code-keyword">new</SPAN>
NotificationBroker(getContext());
+wsnBroker.subscribe(pullPoint.getEndpoint(), topic);</PRE>
+</DIV></DIV>
+
+<P>Later, you can pull notifications from this pull point:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">List<NotificationMessageHolderType> msgs =
pullPoint.getMessages(0);</PRE>
+</DIV></DIV>
+
+<H3><A name="servicemix-wsn2005-OutsidetheJBIbus"></A>Outside the JBI bus</H3>
-<H2><A name="servicemix-wsn2005-EmbeddingWSNotification"></A>Embedding
WS-Notification</H2>
+<P>If you want to use WS-Notification ouside the JBI world, you will need to
be able to receive incoming requests or send notifications to the external
services. This must be done through by using Binding Components, either using
HTTP or JMS.</P>
+<P>To expose the NotificationBroker and CreatePullPoint services using
HTTP/SOAP, you can deploy the following configuration file to <SPAN
class="nobr"><A
href="http://goopen.org/confluence/pages/createpage.action?spaceKey=SM30UG&title=servicemix-http&linkCreation=true&fromPageId=13583"
title="Create Page: servicemix-http"
class="createlink"><TT>servicemix-http</TT><SUP><IMG class="rendericon"
src="http://goopen.org/confluence/images/icons/plus.gif" height="7" width="7"
align="absmiddle" alt="" border="0"></SUP></A></SPAN>:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><beans <SPAN
class="code-keyword">xmlns:http</SPAN>=<SPAN
class="code-quote">"http://servicemix.apache.org/http/1.0"</SPAN>
+ <SPAN class="code-keyword">xmlns:wsn</SPAN>=<SPAN
class="code-quote">"http://servicemix.org/wsnotification"</SPAN>>
+
+ <http:endpoint service=<SPAN
class="code-quote">"wsn:NotificationBroker"</SPAN>
+ endpoint=<SPAN
class="code-quote">"http-binding"</SPAN>
+ targetService=<SPAN
class="code-quote">"wsn:NotificationBroker"</SPAN>
+ targetEndpoint=<SPAN
class="code-quote">"Broker"</SPAN>
+ role=<SPAN class="code-quote">"consumer"</SPAN>
+ locationURI=<SPAN
class="code-quote">"http://localhost:8192/Broker/"</SPAN>
+ defaultMep=<SPAN
class="code-quote">"http://www.w3.org/2004/08/wsdl/in-out"</SPAN>
+ soap=<SPAN class="code-quote">"true"</SPAN>/>
+
+ <http:endpoint service=<SPAN
class="code-quote">"wsn:CreatePullPoint"</SPAN>
+ endpoint=<SPAN
class="code-quote">"http-binding2"</SPAN>
+ targetService=<SPAN
class="code-quote">"wsn:CreatePullPoint"</SPAN>
+ targetEndpoint=<SPAN
class="code-quote">"Broker"</SPAN>
+ role=<SPAN class="code-quote">"consumer"</SPAN>
+ locationURI=<SPAN
class="code-quote">"http://localhost:8192/CreatePullPoint/"</SPAN>
+ defaultMep=<SPAN
class="code-quote">"http://www.w3.org/2004/08/wsdl/in-out"</SPAN>
+ soap=<SPAN class="code-quote">"true"</SPAN>/>
+
+<SPAN class="code-tag"></beans></SPAN></PRE>
+</DIV></DIV>
+
+<H3><A name="servicemix-wsn2005-EmbeddingWSNotification"></A>Embedding
WS-Notification</H3>
+
+<P>If you use a single static configuration file for ServiceMix, you can
easily leverage this component to create subscription, pull-points and publish
messages.</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-keyword">xmlns:sm</SPAN>=<SPAN
class="code-quote">"http://servicemix.apache.org/config/1.0"</SPAN>
+ <SPAN class="code-keyword">xmlns:wsn</SPAN>=<SPAN
class="code-quote">"http://servicemix.apache.org/wsn/1.0"</SPAN>
+ <SPAN class="code-keyword">xmlns:test</SPAN>=<SPAN
class="code-quote">"http://servicemix.org/test"</SPAN>
+
+<SPAN class="code-tag"><sm:activationSpec id=<SPAN
class="code-quote">"receiver"</SPAN> service=<SPAN
class="code-quote">"test:service"</SPAN> endpoint=<SPAN
class="code-quote">"endpoint"</SPAN>></SPAN>
+ <SPAN class="code-tag"><sm:component></SPAN>
+ <SPAN class="code-tag"><bean class=<SPAN
class="code-quote">"org.apache.servicemix.tck.ReceiverComponent"</SPAN>
/></SPAN>
+ <SPAN class="code-tag"></sm:component></SPAN>
+<SPAN class="code-tag"></sm:activationSpec></SPAN>
+
+<SPAN class="code-tag"><sm:activationSpec></SPAN>
+ <SPAN class="code-tag"><sm:component></SPAN>
+ <SPAN class="code-tag"><wsn:component></SPAN>
+ <SPAN class="code-tag"><wsn:requests></SPAN>
+ <SPAN class="code-tag"><wsn:subscribe consumer=<SPAN
class="code-quote">"http://servicemix.org/test/service/endpoint"</SPAN>
topic=<SPAN class="code-quote">"myTopic"</SPAN> /></SPAN>
+ <SPAN class="code-tag"></wsn:requests></SPAN>
+ <SPAN class="code-tag"></wsn:component></SPAN>
+ <SPAN class="code-tag"></sm:component></SPAN>
+<SPAN class="code-tag"></sm:activationSpec></SPAN>
+
+<SPAN class="code-tag"><sm:activationSpec service=<SPAN
class="code-quote">"test:publisher"</SPAN> endpoint=<SPAN
class="code-quote">"endpoint"</SPAN>></SPAN>
+ <SPAN class="code-tag"><sm:component></SPAN>
+ <SPAN class="code-tag"><wsn:publisher topic=<SPAN
class="code-quote">"myTopic"</SPAN> /></SPAN>
+ <SPAN class="code-tag"></sm:component></SPAN>
+<SPAN class="code-tag"></sm:activationSpec></SPAN></PRE>
+</DIV></DIV>
+
+<P>The above code snippet creates a publisher proxy, a subscription and a
subscriber.</P>
+
+<P>The publisher proxy is a simple component that wraps incoming JBI exchanges
into WS-Notification <TT>notify</TT> requests and send them to a notification
broker on the given topic. This could also be written in plain spring
style:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag"><sm:activationSpec
service=<SPAN class="code-quote">"test:publisher"</SPAN>
endpoint=<SPAN class="code-quote">"endpoint"</SPAN>></SPAN>
+ <SPAN class="code-tag"><sm:component></SPAN>
+ <SPAN class="code-tag"><bean class=<SPAN
class="code-quote">"org.apache.servicemix.wsn.spring.PublisherComponent"</SPAN>></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"topic"</SPAN> value=<SPAN
class="code-quote">"myTopic"</SPAN> /></SPAN>
+ <SPAN class="code-tag"></bean></SPAN>
+ <SPAN class="code-tag"></sm:component></SPAN>
+<SPAN class="code-tag"></sm:activationSpec></SPAN></PRE>
+</DIV></DIV>
+
+<P>The subscription is created inside a <TT>servicemix-wsn2005</TT> component.
You must fill the <TT>consumer</TT> and <TT>topic</TT> properties, where the
<TT>consumer</TT> is the URI-encoded target JBI endpoint, which will be
resolved to the first component activated. You could also use the plain spring
syntax:</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag"><sm:activationSpec></SPAN>
+ <SPAN class="code-tag"><sm:component></SPAN>
+ <SPAN class="code-tag"><bean class=<SPAN
class="code-quote">"org.apache.servicemix.wsn.spring.WSNSpringComponent"</SPAN>></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"requests"</SPAN>></SPAN>
+ <SPAN class="code-tag"><list></SPAN>
+ <SPAN class="code-tag"><bean class=<SPAN
class="code-quote">"org.apache.servicemix.wsn.spring.SubscribeFactoryBean"</SPAN>></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"consumer"</SPAN> value=<SPAN
class="code-quote">"http://servicemix.org/test/service/endpoint"</SPAN>
/></SPAN>
+ <SPAN class="code-tag"><property name=<SPAN
class="code-quote">"topic"</SPAN> value=<SPAN
class="code-quote">"myTopic"</SPAN> /></SPAN>
+ <SPAN class="code-tag"></bean></SPAN>
+ <SPAN class="code-tag"></list></SPAN>
+ <SPAN class="code-tag"></property></SPAN>
+ <SPAN class="code-tag"></bean></SPAN>
+ <SPAN class="code-tag"></sm:component></SPAN>
+<SPAN class="code-tag"></sm:activationSpec></SPAN></PRE>
+</DIV></DIV>
+
+<H2><A name="servicemix-wsn2005-WSNotificationmessages"></A>WS-Notification
messages</H2>
+
+<H3><A name="servicemix-wsn2005-Subscribe"></A>Subscribe</H3>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><wsnt:Subscribe
+ <SPAN class="code-keyword">xmlns:wsnt</SPAN>=<SPAN
class="code-quote">"http://docs.oasis-open.org/wsn/b-2"</SPAN>
+ <SPAN class="code-keyword">xmlns:wsa</SPAN>=<SPAN
class="code-quote">"http://www.w3.org/2005/08/addressing"</SPAN>>
+ <SPAN class="code-tag"><wsnt:ConsumerReference></SPAN>
+ <SPAN class="code-tag"><wsa:Address></SPAN>
+ http://www.consumer.org/service/endpoint
+ <SPAN class="code-tag"></wsa:Address></SPAN>
+ <SPAN class="code-tag"></wsnt:ConsumerReference></SPAN>
+ <SPAN class="code-tag"><wsnt:Filter></SPAN>
+ <SPAN class="code-tag"><wsnt:TopicExpression Dialect=<SPAN
class="code-quote">"http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple"</SPAN>></SPAN>
+ myTopic
+ <SPAN class="code-tag"></wsnt:TopicExpression></SPAN>
+ <SPAN class="code-tag"></wsnt:Filter></SPAN>
+<SPAN class="code-tag"></wsnt:Subscribe></SPAN></PRE>
+</DIV></DIV>
+
+<H3><A name="servicemix-wsn2005-CreatePullPoint"></A>CreatePullPoint</H3>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><wsnt:CreatePullPoint
+ <SPAN class="code-keyword">xmlns:wsnt</SPAN>=<SPAN
class="code-quote">"http://docs.oasis-open.org/wsn/b-2"</SPAN>
+ <SPAN class="code-keyword">xmlns:sm</SPAN>=<SPAN
class="code-quote">"http://servicemix.apache.org/wsn2005/1.0"</SPAN>>
+ <SPAN class="code-tag"><sm:address></SPAN>
+ http://www.consumer.org/service/endpoint
+ <SPAN class="code-tag"></sm:address></SPAN>
+<SPAN class="code-tag"></wsnt:CreatePullPoint></SPAN></PRE>
+</DIV></DIV>
+<P>Note that the <TT><sm:address /></TT> element is a ServiceMix
extension that creates a PullPoint on a specific JBI endpoint. This is very
useful when you want to create a subscription for this endpoint at deployment
time (see the previous paragraph).</P>
<STYLE type="text/css">/*<![CDATA[*/
table.ScrollbarTable {border: none;padding: 3px;width: 100%;padding:
3px;margin: 0px;background-color: #f0f0f0}
@@ -88,7 +261,7 @@
<DIV id="site-footer">
Added by <A
href="http://goopen.org/confluence/users/viewuserprofile.action?username=gnodet">Guillaume
Nodet</A>,
last edited by <A
href="http://goopen.org/confluence/users/viewuserprofile.action?username=gnodet">Guillaume
Nodet</A> on Sep 11, 2006
- (<A
href="http://goopen.org/confluence/pages/diffpages.action?pageId=13583&originalId=13588">view
change</A>)
+ (<A
href="http://goopen.org/confluence/pages/diffpages.action?pageId=13583&originalId=13590">view
change</A>)
(<A
href="http://goopen.org/confluence/pages/editpage.action?pageId=13583">edit
page</A>)
</DIV>