cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Genender <jgenen...@apache.org>
Subject Re: How to implement PUB/SUB model in Web service
Date Mon, 02 May 2011 14:17:59 GMT
This really depends.  We have worked with a few clients to implement this as this is becoming
a more and more common architectural pattern.  WSN would normally be the way to go, but it
isn't fully implemented.  We used a "bastardized" version of WSN (i.e. the just the spec WSDLs)
and implemented it with a pullpoint.  It most certainly could have been used with a WS callback
to the client which is what we proposed, but the issue brought up with many clients was firewall
access and NAT.

Hence there are many ways to do this.  If you want full WS communication, the way to do it
is with a WSN like method where you have either a WS callback or an offer of a pullpoint for
the client to do a long poll.  Pullpoint is good for firewall sensitive issues... callbacks
are great for true pub/sub event handling.

The other way to do this (another thing we did) is set up a websocket endpoint to the JMS
provider or maybe even use Mina endpoint (which Johan Edstrom implemented and I can let him
throw in his .02 on this subject if interested) to keep the session (JMS) alive for a period
of time via subscription ID.  You can pass WS calls through this if you wanted to and provide
for true PUB/SUB.

Hence... there are many ways to do this and it will boil down to how intricate and custom
you want to make this.

Jeff

On May 2, 2011, at 7:41 AM, Christian Schneider wrote:

> What you configured here is a service that uses jms transport and a topic. That looks
good at least for the server side. So if your start your server then it will register a a
subscriber to the topic.
> 
> I guess you have a similar configuration for the client?
> 
> So if you started your service and then called it from a client that lives in another
process it was successful. You can check that it really is pub/sub by starting a second serice
witth the same config. If both services get called then it really works.
> 
> You should also be aware that a pub / sub service normally has to be one way.
> 
> A request / reply service also works for one consumer but not for more than one. The
reason is that the client will create a temp reply queue and the service will reply to it.
The client will only wait for one reply though so in case you have no service listening the
client would time out. If you have more than one service listening then all replies beside
the first will be discarded.
> 
> Christian
> 
> 
> Am 02.05.2011 14:06, schrieb more.harshal2007@gmail.com:
>> Look.
>> 
>> I am having a web service project which uses JMS Queue i.e. PTP pattern.
>> Now I generated the client for the above service and able to invoke it.
>> 
>> Now I wish to implement PUB/SUB pattern.
>> So I configured Topic in JMS server and just modify my project configuration
>> as per below
>> 
>>  <jms:destination
>> name="{http://www.springframework.org/schema/beans}HelloPort.jms-destination">
>> 		<jms:address  destinationStyle="topic"
>>     				  jndiConnectionFactoryName="jms/ConnectionFactory"
>>     				  jndiDestinationName="jms/Topic">
>>     	<jms:JMSNamingProperty name="java.naming.factory.initial"
>> value="weblogic.jndi.WLInitialContextFactory"/>
>>     	<jms:JMSNamingProperty name="java.naming.provider.url"
>> value="t3://localhost:7001"/>
>> 		</jms:address>
>> 	</jms:destination>
>> 
>> 
>> and to invoke the web service I did the modification in my JNDI endpoint URI
>> to
>> JMS_ENDPOINT_URI =
>> 
>> "jms:jndi:jms/Topic?jndiInitialContextFactory=weblogic.jndi.WLInitialContextFactory&"
>> +
>> 
>> "jndiConnectionFactoryName=jms/ConnectionFactory&jndiURL=t3://localhost:7001";
>> 
>> Now I invoked web service.
>> It get worked. does it mean it worked. BUT I haven't configured the
>> subscriber for this end point.
>> 
>> 
>> 
>> FYI..
>> 
>> My configuration file contains only below part other than import statements
>> and namespaces.
>> 
>> <jaxws:endpoint
>> 		id="HelloService"
>> 		address="jms://"
>> 		endpointName="HelloPort"
>> 		implementor="com.example.jmsservice.impl.HelloServiceImpl"
>> 		transportId="http://cxf.apache.org/transports/jms">		
>> 	</jaxws:endpoint>
>> 		
>> 	<jms:destination
>> name="{http://www.springframework.org/schema/beans}HelloPort.jms-destination">
>> 		<jms:address  destinationStyle="topic"
>>     				  jndiConnectionFactoryName="jms/ConnectionFactory"
>>     				  jndiDestinationName="jms/Topic">
>>     	<jms:JMSNamingProperty name="java.naming.factory.initial"
>> value="weblogic.jndi.WLInitialContextFactory"/>
>>     	<jms:JMSNamingProperty name="java.naming.provider.url"
>> value="t3://localhost:7001"/>
>> 		</jms:address>
>> 	</jms:destination>
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context: http://cxf.547215.n5.nabble.com/How-to-implement-PUB-SUB-model-in-Web-service-tp4364484p4364535.html
>> Sent from the cxf-dev mailing list archive at Nabble.com.
>> 
> 
> -- 
> Christian Schneider
> CXF and Camel Architect
> SOPERA - The Application Integration Division of Talend
> http://www.talend.com
> 


Mime
View raw message