You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-user@ws.apache.org by Jeff Garrett <je...@gmail.com> on 2007/09/24 18:35:22 UTC

WSN help

Hi.
I have some questions regarding the WSN model with the Pull-method of
notifications as opposed to the push-method.  I am a newbie, so please bare
with me.  I have been reading up all last week so I know some stuff, but not
enough to get started yet.  We are looking to go with this model to replace
an existing push model.
- I want to allow a customer to send a message to subscribe to and
unsubscribe from a topic.  I then parse the message and get the topic and
endpointReference.  If this epr is not in a list of clients, I create a new
object (I call it NotificationClient) that stores a PullPoint and
provides methods for actions like subscribe(topic), unsubscribe(topic),
getMessages(int).  Otherwise, I get the client from the list.  I am fairly
certain I did this part right so far.

But, I am stuck on a couple of things:
- When I create the client, I use the
SimplePullPointCreation().createPullPoint() method, which does all the
things I need (including subscribing itself to NotificationProducer).  But,
it returns an EndpointReference object, not a PullPoint object.  Wouldn't it
make more sense to return the PullPoint object (given the method name) and
create a method in the PullPoint class, if one is not already there, to
return the EndpointReference?   *The thing I need help with is how to
convert or cast the EndpointReference into a SimplePullPoint object, as I
use the SimplePullPoint object and make calls directly to it.*

- I am unsure of how the PullPoint and subscribing would work with this
scenario, which is common for me:
Say I want to subscribe 2 clients, ClientA and ClientB, and each wants to
subscribe to a different topic.  I subscribe ClientA with eprA and ClientB
with erpB.  Each creates its own PullPoint (from above) and their PullPoint
is now subscribed to the NotificationProducer.  But what is the purpose for
the endpoint references for ClientA and ClientB in the subscribe request if
the subscribing is done by the PullPoint, other than identification for who
is subscribing and using that I to find the PullPoint that was created by
that Client?  *And, is the subscribing by the PullPoint not going to be the
same for each time createPullPoint() is called, considering there is no
method input?  Or do I have to create a PullPoint another way, and what is
that way?*

Basically, I want a method that will create a PullPoint, subscribe it to the
NotificationProducer for the topics/filter I provide, and get the PullPoint
object in return, which I use later on to get the messages from.

private void createPullPointAndSubscribe() throws Exception
{
     SimplePullPointCreation s = new SimplePullPointCreation();
     s.initialize();

     EndpointReference pullPointEpr = s.createPullPoint();
     SimplePullPoint pullPoint = ...  //need to cast the pullPointEpr into a
PullPoint object (or do it another way)

     if (!pullPoint.hasBeenInitialized())
     {
          pullPoint.initialize();
     }
}


Thanks.
Jeff G.

RE: WSN help

Posted by Ch...@swisscom.com.
Hi Jeff,

see this post:

http://www.nabble.com/forum/ViewPost.jtp?post=11801156&framed=y

The current muse implementations don't work as expected.  These
implementations do.  In keeping with the rest of Muse there is no
unsubscribe(topic), you simply destroy the resource.

Additionally with whichever resource wsdl you use, that has the
PullPoint functions in it, generate a proxy then use the epr as the
source (see the end of the first post at that chain).

What I didn't implement was a friendlier version of:

Element max = XmlUtils.createElement(el.getOwnerDocument(), new
QName("http://docs.oasis-open.org/wsn/b-2", "MaximumNumber", "pfx0"),
new Integer(10)); 

Element[] res = pullit.getMessages(max); 

i.e. no wrapper for MaximumNumber.  I think this can be done with
handler parameters though (to use a simple int instead).

HTH

cheers,
Chris 

-----Original Message-----
From: Jeff Garrett [mailto:jeffrey.s.garrett@gmail.com] 
Sent: Monday, September 24, 2007 6:35 PM
To: muse-user@ws.apache.org
Subject: WSN help

Hi.
I have some questions regarding the WSN model with the Pull-method of
notifications as opposed to the push-method.  I am a newbie, so please
bare with me.  I have been reading up all last week so I know some
stuff, but not enough to get started yet.  We are looking to go with
this model to replace an existing push model.
- I want to allow a customer to send a message to subscribe to and
unsubscribe from a topic.  I then parse the message and get the topic
and endpointReference.  If this epr is not in a list of clients, I
create a new object (I call it NotificationClient) that stores a
PullPoint and provides methods for actions like subscribe(topic),
unsubscribe(topic), getMessages(int).  Otherwise, I get the client from
the list.  I am fairly certain I did this part right so far.

But, I am stuck on a couple of things:
- When I create the client, I use the
SimplePullPointCreation().createPullPoint() method, which does all the
things I need (including subscribing itself to NotificationProducer).
But, it returns an EndpointReference object, not a PullPoint object.
Wouldn't it make more sense to return the PullPoint object (given the
method name) and create a method in the PullPoint class, if one is not
already there, to
return the EndpointReference?   *The thing I need help with is how to
convert or cast the EndpointReference into a SimplePullPoint object, as
I use the SimplePullPoint object and make calls directly to it.*

- I am unsure of how the PullPoint and subscribing would work with this
scenario, which is common for me:
Say I want to subscribe 2 clients, ClientA and ClientB, and each wants
to subscribe to a different topic.  I subscribe ClientA with eprA and
ClientB with erpB.  Each creates its own PullPoint (from above) and
their PullPoint is now subscribed to the NotificationProducer.  But what
is the purpose for the endpoint references for ClientA and ClientB in
the subscribe request if the subscribing is done by the PullPoint, other
than identification for who is subscribing and using that I to find the
PullPoint that was created by that Client?  *And, is the subscribing by
the PullPoint not going to be the same for each time createPullPoint()
is called, considering there is no method input?  Or do I have to create
a PullPoint another way, and what is that way?*

Basically, I want a method that will create a PullPoint, subscribe it to
the NotificationProducer for the topics/filter I provide, and get the
PullPoint object in return, which I use later on to get the messages
from.

private void createPullPointAndSubscribe() throws Exception {
     SimplePullPointCreation s = new SimplePullPointCreation();
     s.initialize();

     EndpointReference pullPointEpr = s.createPullPoint();
     SimplePullPoint pullPoint = ...  //need to cast the pullPointEpr
into a PullPoint object (or do it another way)

     if (!pullPoint.hasBeenInitialized())
     {
          pullPoint.initialize();
     }
}


Thanks.
Jeff G.

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-user-help@ws.apache.org