org.sharengo.wikitty.jms
Class WikittyStorageSubscriberJMS

java.lang.Object
  extended by org.sharengo.wikitty.jms.WikittyStorageSubscriberJMS
All Implemented Interfaces:
javax.jms.MessageListener

public class WikittyStorageSubscriberJMS
extends Object
implements javax.jms.MessageListener

WikittyStorageSubscriberJMS.

Since:
11 févr. 2010 11:07:30
Version:
$Revision: 1 $ $Date: 2010-04-16 10:29:38 +0200 (ven., 16 avril 2010) $
Author:
$Author: echatellier $

Field Summary
protected  javax.jms.TopicConnectionFactory connectionFactory
           
protected  WikittyStorage delegateStorage
           
protected  javax.jms.Topic topic
           
protected  javax.jms.TopicConnection topicConnection
           
protected  javax.jms.TopicSession topicSession
           
protected  javax.jms.TopicSubscriber topicSubscriber
           
 
Constructor Summary
WikittyStorageSubscriberJMS(WikittyStorage delegateStorage, Properties properties)
          Creates a durable subscriber on a topic named WikittyStorageTopic.
 
Method Summary
protected  void actionClear(WikittyTransaction transaction, WikittyActionMessage message)
           
protected  void actionDelete(WikittyTransaction transaction, WikittyActionMessage message)
           
protected  void actionStore(WikittyTransaction transaction, WikittyActionMessage message)
           
 void close()
           
protected  void finalize()
           
protected  void onActionMessage(WikittyTransaction transaction, WikittyActionMessage message)
           
 void onMessage(javax.jms.Message message)
          Forwards the message to the delegateStorage according to its type (TextMessage or ObjectMessage) and its client properties.
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connectionFactory

protected final javax.jms.TopicConnectionFactory connectionFactory

topicConnection

protected final javax.jms.TopicConnection topicConnection

topic

protected final javax.jms.Topic topic

topicSession

protected final javax.jms.TopicSession topicSession

topicSubscriber

protected final javax.jms.TopicSubscriber topicSubscriber

delegateStorage

protected final WikittyStorage delegateStorage
Constructor Detail

WikittyStorageSubscriberJMS

public WikittyStorageSubscriberJMS(WikittyStorage delegateStorage,
                                   Properties properties)
                            throws NamingException,
                                   javax.jms.JMSException
Creates a durable subscriber on a topic named WikittyStorageTopic. All received messages are dispatched to the specified delegateStorage.

Parameters:
delegateStorage - an instance of WikittyStorage
properties - properties passed to InitialContext, it must contains at least a value for the Context.PROVIDER_URL
Throws:
NamingException
javax.jms.JMSException
Method Detail

start

public void start()
           throws javax.jms.JMSException
Throws:
javax.jms.JMSException

stop

public void stop()
          throws javax.jms.JMSException
Throws:
javax.jms.JMSException

close

public void close()
           throws javax.jms.JMSException
Throws:
javax.jms.JMSException

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

onMessage

public void onMessage(javax.jms.Message message)
Forwards the message to the delegateStorage according to its type (TextMessage or ObjectMessage) and its client properties. More precisely, the action client property determines the delegateStorage's method which will be invoked.

Specified by:
onMessage in interface javax.jms.MessageListener
Parameters:
message - the incoming message

onActionMessage

protected void onActionMessage(WikittyTransaction transaction,
                               WikittyActionMessage message)

actionStore

protected void actionStore(WikittyTransaction transaction,
                           WikittyActionMessage message)
                    throws javax.jms.JMSException
Throws:
javax.jms.JMSException

actionClear

protected void actionClear(WikittyTransaction transaction,
                           WikittyActionMessage message)

actionDelete

protected void actionDelete(WikittyTransaction transaction,
                            WikittyActionMessage message)
                     throws javax.jms.JMSException
Throws:
javax.jms.JMSException


Copyright © 2010 CodeLutin. All Rights Reserved.