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">&quot;/&quot;</SPAN> + service.getLocalPart() + <SPAN 
class="code-quote">&quot;/&quot;</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&lt;NotificationMessageHolderType&gt; 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">&lt;beans <SPAN 
class="code-keyword">xmlns:http</SPAN>=<SPAN 
class="code-quote">&quot;http://servicemix.apache.org/http/1.0&quot;</SPAN>
+       <SPAN class="code-keyword">xmlns:wsn</SPAN>=<SPAN 
class="code-quote">&quot;http://servicemix.org/wsnotification&quot;</SPAN>&gt;
+
+  &lt;http:endpoint service=<SPAN 
class="code-quote">&quot;wsn:NotificationBroker&quot;</SPAN>
+                 endpoint=<SPAN 
class="code-quote">&quot;http-binding&quot;</SPAN>
+                 targetService=<SPAN 
class="code-quote">&quot;wsn:NotificationBroker&quot;</SPAN>
+                 targetEndpoint=<SPAN 
class="code-quote">&quot;Broker&quot;</SPAN>
+                 role=<SPAN class="code-quote">&quot;consumer&quot;</SPAN>
+                 locationURI=<SPAN 
class="code-quote">&quot;http://localhost:8192/Broker/&quot;</SPAN>
+                 defaultMep=<SPAN 
class="code-quote">&quot;http://www.w3.org/2004/08/wsdl/in-out&quot;</SPAN> 
+                 soap=<SPAN class="code-quote">&quot;true&quot;</SPAN>/&gt;    
               
+
+  &lt;http:endpoint service=<SPAN 
class="code-quote">&quot;wsn:CreatePullPoint&quot;</SPAN>
+                 endpoint=<SPAN 
class="code-quote">&quot;http-binding2&quot;</SPAN>
+                 targetService=<SPAN 
class="code-quote">&quot;wsn:CreatePullPoint&quot;</SPAN>
+                 targetEndpoint=<SPAN 
class="code-quote">&quot;Broker&quot;</SPAN>
+                 role=<SPAN class="code-quote">&quot;consumer&quot;</SPAN>
+                 locationURI=<SPAN 
class="code-quote">&quot;http://localhost:8192/CreatePullPoint/&quot;</SPAN>
+                 defaultMep=<SPAN 
class="code-quote">&quot;http://www.w3.org/2004/08/wsdl/in-out&quot;</SPAN>
+                 soap=<SPAN class="code-quote">&quot;true&quot;</SPAN>/&gt;
+
+<SPAN class="code-tag">&lt;/beans&gt;</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">&quot;http://servicemix.apache.org/config/1.0&quot;</SPAN>
+  <SPAN class="code-keyword">xmlns:wsn</SPAN>=<SPAN 
class="code-quote">&quot;http://servicemix.apache.org/wsn/1.0&quot;</SPAN> 
+  <SPAN class="code-keyword">xmlns:test</SPAN>=<SPAN 
class="code-quote">&quot;http://servicemix.org/test&quot;</SPAN>
+
+<SPAN class="code-tag">&lt;sm:activationSpec id=<SPAN 
class="code-quote">&quot;receiver&quot;</SPAN> service=<SPAN 
class="code-quote">&quot;test:service&quot;</SPAN> endpoint=<SPAN 
class="code-quote">&quot;endpoint&quot;</SPAN>&gt;</SPAN>
+  <SPAN class="code-tag">&lt;sm:component&gt;</SPAN>
+    <SPAN class="code-tag">&lt;bean class=<SPAN 
class="code-quote">&quot;org.apache.servicemix.tck.ReceiverComponent&quot;</SPAN>
 /&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/sm:component&gt;</SPAN>
+<SPAN class="code-tag">&lt;/sm:activationSpec&gt;</SPAN>
+
+<SPAN class="code-tag">&lt;sm:activationSpec&gt;</SPAN>
+  <SPAN class="code-tag">&lt;sm:component&gt;</SPAN>
+    <SPAN class="code-tag">&lt;wsn:component&gt;</SPAN>
+      <SPAN class="code-tag">&lt;wsn:requests&gt;</SPAN>
+        <SPAN class="code-tag">&lt;wsn:subscribe consumer=<SPAN 
class="code-quote">&quot;http://servicemix.org/test/service/endpoint&quot;</SPAN>
 topic=<SPAN class="code-quote">&quot;myTopic&quot;</SPAN> /&gt;</SPAN>
+      <SPAN class="code-tag">&lt;/wsn:requests&gt;</SPAN>
+    <SPAN class="code-tag">&lt;/wsn:component&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/sm:component&gt;</SPAN>
+<SPAN class="code-tag">&lt;/sm:activationSpec&gt;</SPAN>
+
+<SPAN class="code-tag">&lt;sm:activationSpec service=<SPAN 
class="code-quote">&quot;test:publisher&quot;</SPAN> endpoint=<SPAN 
class="code-quote">&quot;endpoint&quot;</SPAN>&gt;</SPAN>
+  <SPAN class="code-tag">&lt;sm:component&gt;</SPAN>
+    <SPAN class="code-tag">&lt;wsn:publisher topic=<SPAN 
class="code-quote">&quot;myTopic&quot;</SPAN> /&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/sm:component&gt;</SPAN>
+<SPAN class="code-tag">&lt;/sm:activationSpec&gt;</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">&lt;sm:activationSpec 
service=<SPAN class="code-quote">&quot;test:publisher&quot;</SPAN> 
endpoint=<SPAN class="code-quote">&quot;endpoint&quot;</SPAN>&gt;</SPAN>
+  <SPAN class="code-tag">&lt;sm:component&gt;</SPAN>
+    <SPAN class="code-tag">&lt;bean class=<SPAN 
class="code-quote">&quot;org.apache.servicemix.wsn.spring.PublisherComponent&quot;</SPAN>&gt;</SPAN>
+      <SPAN class="code-tag">&lt;property name=<SPAN 
class="code-quote">&quot;topic&quot;</SPAN> value=<SPAN 
class="code-quote">&quot;myTopic&quot;</SPAN> /&gt;</SPAN>
+    <SPAN class="code-tag">&lt;/bean&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/sm:component&gt;</SPAN>
+<SPAN class="code-tag">&lt;/sm:activationSpec&gt;</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">&lt;sm:activationSpec&gt;</SPAN>
+  <SPAN class="code-tag">&lt;sm:component&gt;</SPAN>
+    <SPAN class="code-tag">&lt;bean class=<SPAN 
class="code-quote">&quot;org.apache.servicemix.wsn.spring.WSNSpringComponent&quot;</SPAN>&gt;</SPAN>
+      <SPAN class="code-tag">&lt;property name=<SPAN 
class="code-quote">&quot;requests&quot;</SPAN>&gt;</SPAN>
+        <SPAN class="code-tag">&lt;list&gt;</SPAN>
+          <SPAN class="code-tag">&lt;bean class=<SPAN 
class="code-quote">&quot;org.apache.servicemix.wsn.spring.SubscribeFactoryBean&quot;</SPAN>&gt;</SPAN>
+            <SPAN class="code-tag">&lt;property name=<SPAN 
class="code-quote">&quot;consumer&quot;</SPAN> value=<SPAN 
class="code-quote">&quot;http://servicemix.org/test/service/endpoint&quot;</SPAN>
 /&gt;</SPAN>
+            <SPAN class="code-tag">&lt;property name=<SPAN 
class="code-quote">&quot;topic&quot;</SPAN> value=<SPAN 
class="code-quote">&quot;myTopic&quot;</SPAN> /&gt;</SPAN>
+          <SPAN class="code-tag">&lt;/bean&gt;</SPAN>
+        <SPAN class="code-tag">&lt;/list&gt;</SPAN>
+      <SPAN class="code-tag">&lt;/property&gt;</SPAN>
+    <SPAN class="code-tag">&lt;/bean&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/sm:component&gt;</SPAN>
+<SPAN class="code-tag">&lt;/sm:activationSpec&gt;</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">&lt;wsnt:Subscribe
+  <SPAN class="code-keyword">xmlns:wsnt</SPAN>=<SPAN 
class="code-quote">&quot;http://docs.oasis-open.org/wsn/b-2&quot;</SPAN>
+  <SPAN class="code-keyword">xmlns:wsa</SPAN>=<SPAN 
class="code-quote">&quot;http://www.w3.org/2005/08/addressing&quot;</SPAN>&gt;
+  <SPAN class="code-tag">&lt;wsnt:ConsumerReference&gt;</SPAN>
+    <SPAN class="code-tag">&lt;wsa:Address&gt;</SPAN>
+      http://www.consumer.org/service/endpoint
+    <SPAN class="code-tag">&lt;/wsa:Address&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/wsnt:ConsumerReference&gt;</SPAN>
+  <SPAN class="code-tag">&lt;wsnt:Filter&gt;</SPAN>
+    <SPAN class="code-tag">&lt;wsnt:TopicExpression Dialect=<SPAN 
class="code-quote">&quot;http://docs.oasis-open.org/wsn/t-1/TopicExpression/Simple&quot;</SPAN>&gt;</SPAN>
+      myTopic
+    <SPAN class="code-tag">&lt;/wsnt:TopicExpression&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/wsnt:Filter&gt;</SPAN>
+<SPAN class="code-tag">&lt;/wsnt:Subscribe&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<H3><A name="servicemix-wsn2005-CreatePullPoint"></A>CreatePullPoint</H3>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml">&lt;wsnt:CreatePullPoint 
+  <SPAN class="code-keyword">xmlns:wsnt</SPAN>=<SPAN 
class="code-quote">&quot;http://docs.oasis-open.org/wsn/b-2&quot;</SPAN>
+  <SPAN class="code-keyword">xmlns:sm</SPAN>=<SPAN 
class="code-quote">&quot;http://servicemix.apache.org/wsn2005/1.0&quot;</SPAN>&gt;
+  <SPAN class="code-tag">&lt;sm:address&gt;</SPAN> 
+    http://www.consumer.org/service/endpoint
+  <SPAN class="code-tag">&lt;/sm:address&gt;</SPAN>
+<SPAN class="code-tag">&lt;/wsnt:CreatePullPoint&gt;</SPAN></PRE>
+</DIV></DIV>
 
+<P>Note that the <TT>&lt;sm:address /&gt;</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
-                  &nbsp;(<A 
href="http://goopen.org/confluence/pages/diffpages.action?pageId=13583&originalId=13588";>view
 change</A>)
+                  &nbsp;(<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>


Reply via email to