You need two things to deploy a WSN producer -
1. a resource that has the NotificationProducer capability. this is the
resource that is actually creating events and publishing them.
2. a section resource type that represents subscriptions. this type can be
very simple - just has to implement WSRP Get, WSN SubscriptionManager,
and, optionally, WSRL capabilities for lifecycle operations. The muse.xml
fragment for subscription resources should look like this (even has WSRL
:) ):
<resource-type>
<context-path>subscription-manager</context-path>
<wsdl>
<wsdl-file>wsdl/WS-BaseNotification-1_3.wsdl</
wsdl-file>
<wsdl-port-type>wsntw:SubscriptionManager</
wsdl-port-type>
</wsdl>
<java-id-factory-class>
org.apache.muse.core.routing.CounterResourceIdFactory</
java-id-factory-class>
<java-resource-class>
org.apache.muse.ws.resource.impl.SimpleWsResource</java-resource-class>
<capability>
<capability-uri>
http://docs.oasis-open.org/wsrf/rlw-2/ImmediateResourceTermination</
capability-uri>
<java-capability-class>
org.apache.muse.ws.resource.lifetime.impl.SimpleImmediateTermination</
java-capability-class>
</capability>
<capability>
<capability-uri>
http://docs.oasis-open.org/wsrf/rlw-2/ScheduledResourceTermination</
capability-uri>
<java-capability-class>
org.apache.muse.ws.resource.lifetime.impl.SimpleScheduledTermination</
java-capability-class>
</capability>
<capability>
<capability-uri>
http://docs.oasis-open.org/wsrf/rpw-2/Get</capability-uri>
<java-capability-class>
org.apache.muse.ws.resource.properties.get.impl.SimpleGetCapability</
java-capability-class>
</capability>
<capability>
<capability-uri>
http://docs.oasis-open.org/wsn/bw-2/SubscriptionManager</capability-uri>
<java-capability-class>
org.apache.muse.ws.notification.impl.SimpleSubscriptionManager</
java-capability-class>
<init-param>
<param-name>trace-notifications</
param-name>
<param-value>true</param-value>
</init-param>
</capability>
</resource-type>
At startup, the resource that has NotificationProducer will look for
another resource type that is a subscription type. This will ensure that
it can implement the WSN pub/sub system as intended. It will create
instances of the subscription type for every call you make to subscribe().
If you use the NotificationProducerClient to call subscribe(), you'll get
back an EPR that can be used to talk to the subscription ws-resource (to
call destroy(), for example).
Don't create any instances of subscriptions on your own. The
NotificationProducer impl will do that. Just handle the creation of your
own resources, and subscriptions will handle themselves. From within your
producer resource code, you can publish messages using the code below.
Remember that WSRP change notifications and WSRL termination notifications
are handled automatically.
QName topic = ... // can be null
Element payload = ...
// also works: XmlSerializable payload = ...
NotificationProducer wsn =
getResource().getCapability(WsnConstants.PRODUCER_URI);
wsn.publish(topic, payload);
"Hawkins, Joel" <[EMAIL PROTECTED]> wrote on 07/26/2006 01:31:59
PM:
> That's what I've done (haven't been sitting around waiting ;-) )
>
> So now my resource has the SubscriptionManager capability (which seems
> wrong, but OK). Now I'm getting some issues with initialization of the
> SimpleSubscriptionManager - [ID = 'NoProducerEPR'] The Subscription has
> no ProducerReference - you must set the producer with
> setProducerReference() before initialization.
>
> I'm creating the resource during startup (using the muse.xml
> startupcount attribute).
>
> So, to review the bidding -
>
> I started with a simple resource with the following capabilities:
>
> GetMetaData,
> MetaDataCapability
> ImmediateResourceTermination
> ScheduledResourceTermination
> Property Get/Query/Set
>
> All was well. I then added:
> NotificationProducer
> Advertisement
>
> Which required feeding a number of additional properties to the schema.
> SimpleNotificationProducer complained about not having a
> SubscriptionManager.
>
> Feeding the resource a subscriptionmanager capability is where we came
> in.
>
>
> Now, I assume that what I really need is to create another resource type
> with the subscriptionmanager capability, make it a startup instance of
> 1, and put it before my problem child resource in muse.xml, right? Now,
> what wsdl should I use? Yesterday I pointed at the WSN wsdl and used the
> subscriptionmanager port, and that's what started all of this (missing
> methods and stuff). Where am I going off into the weeds?
>
> Thanks and sorry for the distraction,
> Joel
>
>
>
> -----Original Message-----
> From: Daniel Jemiolo [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 26, 2006 12:41 PM
> To: [email protected]
> Subject: RE: Possible Missing Operations on SubscriptionManager?
>
> You want to keep SubscriptionManager, but add
> ImmediateResourceTermination
> and/or ScheduledResourceTermination:
>
> <capability>
> <capability-uri>
> http://docs.oasis-open.org/wsrf/rlw-2/ImmediateResourceTermination</
> capability-uri>
> <java-capability-class>
> org.apache.muse.ws.resource.lifetime.impl.SimpleImmediateTermination</
> java-capability-class>
> </capability>
> <capability>
> <capability-uri>
> http://docs.oasis-open.org/wsrf/rlw-2/ScheduledResourceTermination</
> capability-uri>
> <java-capability-class>
> org.apache.muse.ws.resource.lifetime.impl.SimpleScheduledTermination</
> java-capability-class>
> </capability>
>
>
> The IBM stuff is part of MUSE-33 cleanup...
>
>
>
> "Hawkins, Joel" <[EMAIL PROTECTED]> wrote on 07/26/2006
> 12:33:30
> PM:
>
> > Dan wrote
> >
> > > I didn't implement Unsubscribe and Renew because a) time is short,
> and
> > > b)
> > > they are redundant. I believe that the reason these two operations
> > exist
> > >
> > > is to allow people to implement subscription resources without a
> > > dependency on WSRF. Subscriptions that are WSRF-based use Destroy
> for
> > > Unsubscribe and SetTerminationTime for Renew - the concepts are
> > exactly
> > > the same, but in each case, the former is based on WSRL. With Muse,
> > all
> > > resources implement the implied resource pattern, so most of the
> WS-*
> > > foundation that one would be looking to avoid when ditching WSRF is
> > > already present; that being the case, I would advise someone to just
> > add
> > >
> > > in the WSRL capabilities if either of these operations are desired.
> > > You're already pulling in WSRF for the NotificationProducer impl, so
>
> > > you might as
> > > well take advantage of that and use WSRL in the subscription
> resource
> > > rather than adding duplicate code to the app.
> > >
> >
> > Well, when I remove SubscriptionManager from the mix, I get the
> > following out of SimpleNotificationProducer's initialize method:
> >
> > [ID = 'NoSubscriptionManager'] There is no resource that implements
> the
> > WS-N SubscriptionManager portType defined in touchpoint.xml. In order
> to
> > use and manage subscriptions, a touchpoint must expose a resource of
> > type com.ibm.ws.notification.Subscription (or a sub-type); this
> resource
> > will represent all new subscriptions created by the resource.
> >
> > I'm at a bit of a loss - any ideas? The com.ibm bit makes me a bit
> > squeamish... am I still skiing out of bounds here?
> >
> > Thanks,
> > Joel
> >
> >
> > The contents of this e-mail are intended for the named addressee only.
>
> It
> > contains information that may be confidential. Unless you are the
> named
> > addressee or an authorized designee, you may not copy or use it, or
> disclose
> > it to anyone else. If you received it in error please notify us
> immediately
> > and then destroy it.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> The contents of this e-mail are intended for the named addressee only.
It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or
disclose
> it to anyone else. If you received it in error please notify us
immediately
> and then destroy it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]