Hi Dan,
Thanks for your reply. Here are my remarks:
1). I succeeded in creating a resource and have calls to "Subscribe" and
"GetCurrentMessage" working. What was missing for me, and I could deduce it
finally by reading some other thread on the mailing list, was how to address a
specific topic. What I found out was the following:
When there is a resource r with the PREFIX and NAMESPACE_URI then the QName for
the topic must be
QName qname = new QName(r.NAMESPACE_URI, r.PROPERTIES.getLocalPart(), r.PREFIX);
Where PROPERTIES is
private static final QName[] PROPERTIES = new QName[] {
new QName(NAMESPACE_URI, "ResourceName", PREFIX)
};
from the Implementation of the resource. With this QName it was then possible
to setup the filter for the "Subscribe" method
Filter filter = new TopicFilter(qname);
and the
final NotificationMessage msg = producer.getCurrentMessage(qname);
With this it was possible to get both methods working by selecting a specific
topic (of course the getCurrentMessage didn't return a message, but a
NoCurrentMessageOnTopicFault, but that was expected ;-)
Maybe this is trivial, but for me it was not clear how to access a topic and so
reference a resource.
For the properties you mentioned the spec.
http://docs.oasis-open.org/wsn/wsn-ws_base_notification-1.3-spec-os.pdf
defines them in chapter 4.1 (Lines from 401 up to 466). Also I found some
examples and some mailing thread where this was already said. So this was
solved rather quickly.
2. and 3.
I was thinking of using a factory resource and to create my own Jms Topic
resources by means of some external resource property file. As I'm focusing on
WS-N, I didn't investigate any time in the WSDM spec. So I will have a look at
those and see for the RMD file.
4. I don't agree on using the subscription.destroy method. But I would like to
discuss this in another thread as IMHO this does not belong in this thread ;-)
I will see after the RMD file and see what is for me the best way of creating
the resources.
When I found a solution I will report this in this thread.
THX again a lot.
Matthias
-----Ursprüngliche Nachricht-----
Von: Daniel Jemiolo [mailto:[EMAIL PROTECTED]
Gesendet: Samstag, 17. März 2007 18:09
An: [email protected]
Betreff: Re: Relation between Resource and Topic
Hi,
Each resource that includes the WSN NotificationProducer capability as
part of its definition can have topics. These topics allow other resources
to subscribe to a subset of notifications from the producer resource (the
subscriber can also subscribe on behalf of other resources, in effect
saying "please send notifications on topic X to resource Y (not me)"). The
way to implement your scenario would be as follows:
1. Add the WSN NotificationProducer properties and operations to your
WSDL. The tutorial's sample WSDL and the wsn-producer sample project WSDL
both have all of the XML you need - just cut and paste. The properties are
TopicExpression, TopicExpressionDialect, TopicSet, and FixedTopicSet; the
operations are Subscribe and GetCurrentMessage.
2. Create an RMD (metadata) file and add a <Property/> entry for the
TopicExpression property. The wsrf and wsn-producer sample projects both
have example RMD files, and the WSDL portType link to those RMD files. The
<Property/> metadata for TopicExpression should look like this:
<Property xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
name="wsnt:TopicExpression" modifiability="read-only"
mutability="constant">
<StaticValues>
<wsnt:TopicExpression
xmlns:myns="http://my/topic/namespace">myns:MyTopicName<wsnt:TopicExpression>
... more
</StaticValues>
</Property>
You can fill in as many instances of TopicExpression as you like, and they
will be loaded when the application is started. That way, when clients
query your resource to see what topics it has (using
GetResourceProperty(wsnt:TopicExpression)), they'll get the list of topics
you put in the RMD file. They can then use those topic names in the
subscribe() requests.
In your case, you can create one <TopicExpression/> for each JMS topic you
want to expose.
3. Run WSDL2Java. It will generate the code/XML for your resource
definition, and add the WSN subscription resource as well. By default, one
instance of your producer resource will be created at application startup,
and new subscription resources will be created for each call to
subscribe().
4. From the client side, you can use
org.apache.muse.ws.notification.remote.NotificationProducerClient to
invoke subscribe() and getCurrentMessage(). The subscribe() method will
return a SubscriptionClient, the primary use of which is to invoke
destroy() when you want the notifications to stop (if ever).
Let me know if you need me to elaborate on any of these steps.
Dan
"Beil, Matthias" <[EMAIL PROTECTED]> wrote on 03/15/2007 11:43:11 AM:
> Hi,
>
>
>
> I just started with Muse and can not find a solution for my problem.
>
>
>
> My scenario is a follow:
>
>
>
> - I have several Jms Topic to manage. For each Jms Topic I want to
> define a Ws-Topic where clients can subscribe to. For each subscription
> a durable subscription will be created on the Jms Topic (parameter
> involved are clientID and messageSelector).
>
>
>
> With the subscription created the client can either retrieve messages
> via the GetCurrentMessage method, or register for receiving "notify"
> messages.
>
>
>
> My question is now, how do I setup this? What kind of resource do I have
> to setup? How is a resource related to a Ws-Topic and how do I address
> such a Ws-Topic. Where can I find some documentation/source code or
> useful information's about of those details?
>
>
>
> I have read the WS-N, WS-WSRF spec's, gone through the Muse
> documentation, checked the samples, had a look over the mail archive,
> but couldn't make up how resources and topic's are related which each
> other. Also the addressing isn't clear for me.
>
>
>
> Any help would be appreciated. THX
>
>
>
> Mit freundlichen Gruessen / With kind regards
>
> Matthias Beil
>
---------------------------------------------------------------------
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]