org.objectweb.joram.mom.dest
Class AcquisitionModule

java.lang.Object
  extended by org.objectweb.joram.mom.dest.AcquisitionModule
All Implemented Interfaces:
ReliableTransmitter

public class AcquisitionModule
extends java.lang.Object
implements ReliableTransmitter

The AcquisitionModule interfaces between the acquisition destinations and the specified AcquisitionHandler.


Nested Class Summary
(package private)  class AcquisitionModule.AcquisitionTask
           
 
Field Summary
protected  java.lang.Object acquisitionHandler
          The acquisition logic.
private  AcquisitionModule.AcquisitionTask acquisitionTask
          The task used to launch a new acquisition.
static java.lang.String CLASS_NAME
          The property name for the acquisition handler class name.
private  DestinationImpl destination
          The acquisition queue or topic using this module.
private  byte destType
          The destination type set in acquired messages/
private  long expiration
          The duration of produced messages.
static java.lang.String EXPIRATION_PROPERTY
          Expiration property name: tells the life expectancy of produced messages.
private  boolean isDaemon
          Tells if acquisition is done on-demand using the acquisition task or with a daemon.
private  boolean isPersistent
          Tells if the messages produced are persistent.
static org.objectweb.util.monolog.api.Logger logger
           
private  long period
          The period before subsequent acquisition if positive.
static java.lang.String PERIOD
          The property name for the acquisition period.
static java.lang.String PERSISTENT_PROPERTY
          Persistent property name: tells if produced messages will be persistent.
private  int priority
          The priority of produced messages, default is 4.
static java.lang.String PRIORITY_PROPERTY
          Priority property name: tells the JMS priority of produced messages.
 
Constructor Summary
AcquisitionModule(DestinationImpl destination, java.lang.String className, java.util.Properties properties, byte destType)
           
 
Method Summary
 ClientMessages acquisitionNot(AcquisitionNot not, long msgCount)
           
static void checkAcquisitionClass(java.lang.String className)
           
 void close()
          Closes the handler.
 long getExpiration()
          Returns the expiration value for produced messages.
 long getPeriod()
           
 int getPriority()
          Returns the priority of produced messages.
 boolean isMessagePersistent()
          Returns true if the messages produced are persistent.
 java.util.Properties processMessages(ClientMessages cm)
          In periodic mode (period > 0), a message with non-null properties will be treated as a new configuration for the destination, and ignored otherwise.
 void setExpiration(long expiration)
          Sets the expiration value for produced messages.
 void setMessagePersistent(boolean isPersistent)
          Sets the DeliveryMode value for the produced messages.
private  void setMessagesInfo(java.util.List messages, long msgCount)
           
 void setPriority(int priority)
          Sets the priority of produced messages.
private  void setProperties(java.util.Properties properties)
          Resets the acquisition properties.
private static java.util.Properties transform(Properties properties)
           
 void transmit(java.util.List messages, java.lang.String messagesId)
          Transmits a list of messages to the MOM in a reliable way: messages have been persisted when the method returns and therefore can be safely acknowledged.
 void transmit(Message message, java.lang.String messageId)
          Transmits a message to the MOM in a reliable way: message has been persisted when the method returns and therefore can be safely acknowledged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static org.objectweb.util.monolog.api.Logger logger

PERIOD

public static final java.lang.String PERIOD
The property name for the acquisition period.

See Also:
Constant Field Values

CLASS_NAME

public static final java.lang.String CLASS_NAME
The property name for the acquisition handler class name.

See Also:
Constant Field Values

PERSISTENT_PROPERTY

public static final java.lang.String PERSISTENT_PROPERTY
Persistent property name: tells if produced messages will be persistent.

See Also:
Constant Field Values

EXPIRATION_PROPERTY

public static final java.lang.String EXPIRATION_PROPERTY
Expiration property name: tells the life expectancy of produced messages.

See Also:
Constant Field Values

PRIORITY_PROPERTY

public static final java.lang.String PRIORITY_PROPERTY
Priority property name: tells the JMS priority of produced messages.

See Also:
Constant Field Values

acquisitionHandler

protected java.lang.Object acquisitionHandler
The acquisition logic.


priority

private int priority
The priority of produced messages, default is 4.


isPersistent

private boolean isPersistent
Tells if the messages produced are persistent.


expiration

private long expiration
The duration of produced messages.


destination

private final DestinationImpl destination
The acquisition queue or topic using this module.


destType

private final byte destType
The destination type set in acquired messages/


period

private long period
The period before subsequent acquisition if positive.


acquisitionTask

private AcquisitionModule.AcquisitionTask acquisitionTask
The task used to launch a new acquisition.


isDaemon

private boolean isDaemon
Tells if acquisition is done on-demand using the acquisition task or with a daemon.

Constructor Detail

AcquisitionModule

public AcquisitionModule(DestinationImpl destination,
                         java.lang.String className,
                         java.util.Properties properties,
                         byte destType)
Method Detail

checkAcquisitionClass

public static void checkAcquisitionClass(java.lang.String className)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

transform

private static java.util.Properties transform(Properties properties)

isMessagePersistent

public boolean isMessagePersistent()
Returns true if the messages produced are persistent.

Returns:
true if the messages produced are persistent.

setMessagePersistent

public void setMessagePersistent(boolean isPersistent)
Sets the DeliveryMode value for the produced messages. If the parameter is true the messages produced are persistent.

Parameters:
isPersistent - if true the messages produced are persistent.

getPriority

public int getPriority()
Returns the priority of produced messages.

Returns:
the priority of produced messages.

setPriority

public void setPriority(int priority)
Sets the priority of produced messages.

Parameters:
priority - the priority to set.

getExpiration

public long getExpiration()
Returns the expiration value for produced messages.

Returns:
the expiration value for produced messages.

setExpiration

public void setExpiration(long expiration)
Sets the expiration value for produced messages.

Parameters:
expiration - the expiration to set.

setProperties

private void setProperties(java.util.Properties properties)
Resets the acquisition properties.


processMessages

public java.util.Properties processMessages(ClientMessages cm)
In periodic mode (period > 0), a message with non-null properties will be treated as a new configuration for the destination, and ignored otherwise.

In request mode, a message received will launch an acquisition process with the given message properties or use the last known properties if empty.

Destination mode can be changed using the "period" property.


acquisitionNot

public ClientMessages acquisitionNot(AcquisitionNot not,
                                     long msgCount)

setMessagesInfo

private void setMessagesInfo(java.util.List messages,
                             long msgCount)

close

public void close()
Closes the handler.


transmit

public void transmit(Message message,
                     java.lang.String messageId)
Description copied from interface: ReliableTransmitter
Transmits a message to the MOM in a reliable way: message has been persisted when the method returns and therefore can be safely acknowledged. The message ID is used to avoid duplicates if a server crash happens right after transmitting the message and before it has been acknowledged. It can be null if such duplicates are tolerated.

Specified by:
transmit in interface ReliableTransmitter
Parameters:
message - the message to transmit
messageId - the unique ID of the transmitted message

transmit

public void transmit(java.util.List messages,
                     java.lang.String messagesId)
Description copied from interface: ReliableTransmitter
Transmits a list of messages to the MOM in a reliable way: messages have been persisted when the method returns and therefore can be safely acknowledged. The ID is used to avoid duplicates if a server crash happens right after transmitting the messages and before they have been acknowledged. It can be null if such duplicates are tolerated.

Specified by:
transmit in interface ReliableTransmitter
Parameters:
messages - the messages to transmit
messagesId - a unique ID for the list of transmitted messages.

getPeriod

public long getPeriod()


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.