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 Gero Vermaas <gv...@xebia.com> on 2007/03/21 12:40:20 UTC

How to subscribe to topic

Hi,

This may be a very basic question, but I have not been able to find a 
answer myself yet...

I've got the following code:
    Topic topic = ...
   
    URI producerEndpointURI = new URI(producerEndpointURL);
    EndpointReference epr = new EndpointReference(producerEndpointURI);
   
    String webAppRoot = "/ossj-tck-wsn-consumer/services";
    String contextPath = webAppRoot + "/consumer";
    URI address = getLocalAddress(contextPath, consumerPort);
    EndpointReference consumer = new EndpointReference(address);
   
    // null filter == send all messages to consumer
    producerClient = new NotificationProducerClient(epr);
    producerClient.setTrace(true);
   
    wsnPropagator.subscribe(wsnTopicQName, this);
   
    producerClient.subscribe(consumer, null, null);

The question I now have it how do I till the producer that the client 
wants to subscribe to a specific Topic.

As a background, I'm building the client side and the guys building the 
server side that sends out the notification expect something like

<wsnt:TopicExpression 
Dialect="http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Simple">
            
System/JSR264/ApplicationType/OrderManagement/Application/0-11;0-0;ReferenceImplementation/Comp/XVTEventTopic
</wsnt:TopicExpression>

as part of the subscribe request. I can't find a way to tell the 
producer the topicexpression.

Is there an example that illustrates this?

Regards,
Gero

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


Re: How to subscribe to topic

Posted by Gero Vermaas <gv...@xebia.com>.
Thanks... I misread the doc on Filter and was assuming that this 
filtering would take place on the client. But it is indeed used on the 
server to determine which messages to sent out to the subscriber. The 
topic information is now included in the subscribe requests.

Regards,
Gero


lenni.madsen@bt.com wrote:
> Hi Gero
>
> It's all handled with the call to 
> producerClient.subscribe(consumer, null, null);
> http://ws.apache.org/muse/docs/2.2.0/javadoc/org/apache/muse/ws/notifica
> tion/impl/SimpleNotificationProducer.html
>
> Where parameter 2 is for your filter (topic), see
> http://ws.apache.org/muse/docs/2.2.0/javadoc/org/apache/muse/ws/notifica
> tion/impl/TopicFilter.html
> And the parameter 3 is for your policies.
>
> At least that's my understanding, I'm sure Dan has a better
> clarification. Based on my understanding I would say you need to put the
> topic of choice in the 2 parameter position in your .subscribe call
>
> /Lenni
>
>
> -----Original Message-----
> From: Gero Vermaas [mailto:gvermaas@xebia.com] 
> Sent: 21 March 2007 11:40
> To: muse-user@ws.apache.org
> Subject: How to subscribe to topic
>
> Hi,
>
> This may be a very basic question, but I have not been able to find a 
> answer myself yet...
>
> I've got the following code:
>     Topic topic = ...
>    
>     URI producerEndpointURI = new URI(producerEndpointURL);
>     EndpointReference epr = new EndpointReference(producerEndpointURI);
>    
>     String webAppRoot = "/ossj-tck-wsn-consumer/services";
>     String contextPath = webAppRoot + "/consumer";
>     URI address = getLocalAddress(contextPath, consumerPort);
>     EndpointReference consumer = new EndpointReference(address);
>    
>     // null filter == send all messages to consumer
>     producerClient = new NotificationProducerClient(epr);
>     producerClient.setTrace(true);
>    
>     wsnPropagator.subscribe(wsnTopicQName, this);
>    
>     producerClient.subscribe(consumer, null, null);
>
> The question I now have it how do I till the producer that the client 
> wants to subscribe to a specific Topic.
>
> As a background, I'm building the client side and the guys building the 
> server side that sends out the notification expect something like
>
> <wsnt:TopicExpression 
> Dialect="http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Simple">
>             
> System/JSR264/ApplicationType/OrderManagement/Application/0-11;0-0;Refer
> enceImplementation/Comp/XVTEventTopic
> </wsnt:TopicExpression>
>
> as part of the subscribe request. I can't find a way to tell the 
> producer the topicexpression.
>
> Is there an example that illustrates this?
>
> Regards,
> Gero
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: muse-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: muse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: muse-user-help@ws.apache.org
>
>   

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


RE: How to subscribe to topic

Posted by le...@bt.com.
Hi Gero

It's all handled with the call to 
producerClient.subscribe(consumer, null, null);
http://ws.apache.org/muse/docs/2.2.0/javadoc/org/apache/muse/ws/notifica
tion/impl/SimpleNotificationProducer.html

Where parameter 2 is for your filter (topic), see
http://ws.apache.org/muse/docs/2.2.0/javadoc/org/apache/muse/ws/notifica
tion/impl/TopicFilter.html
And the parameter 3 is for your policies.

At least that's my understanding, I'm sure Dan has a better
clarification. Based on my understanding I would say you need to put the
topic of choice in the 2 parameter position in your .subscribe call

/Lenni


-----Original Message-----
From: Gero Vermaas [mailto:gvermaas@xebia.com] 
Sent: 21 March 2007 11:40
To: muse-user@ws.apache.org
Subject: How to subscribe to topic

Hi,

This may be a very basic question, but I have not been able to find a 
answer myself yet...

I've got the following code:
    Topic topic = ...
   
    URI producerEndpointURI = new URI(producerEndpointURL);
    EndpointReference epr = new EndpointReference(producerEndpointURI);
   
    String webAppRoot = "/ossj-tck-wsn-consumer/services";
    String contextPath = webAppRoot + "/consumer";
    URI address = getLocalAddress(contextPath, consumerPort);
    EndpointReference consumer = new EndpointReference(address);
   
    // null filter == send all messages to consumer
    producerClient = new NotificationProducerClient(epr);
    producerClient.setTrace(true);
   
    wsnPropagator.subscribe(wsnTopicQName, this);
   
    producerClient.subscribe(consumer, null, null);

The question I now have it how do I till the producer that the client 
wants to subscribe to a specific Topic.

As a background, I'm building the client side and the guys building the 
server side that sends out the notification expect something like

<wsnt:TopicExpression 
Dialect="http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Simple">
            
System/JSR264/ApplicationType/OrderManagement/Application/0-11;0-0;Refer
enceImplementation/Comp/XVTEventTopic
</wsnt:TopicExpression>

as part of the subscribe request. I can't find a way to tell the 
producer the topicexpression.

Is there an example that illustrates this?

Regards,
Gero

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


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