public class AcquisitionModule extends Object implements ReliableTransmitter
AcquisitionModule
interfaces between the acquisition destinations
and the specified AcquisitionHandler
.Modifier and Type | Class and Description |
---|---|
(package private) class |
AcquisitionModule.AcquisitionTask |
Modifier and Type | Field and Description |
---|---|
protected Object |
acquisitionHandler
The acquisition logic.
|
private AcquisitionModule.AcquisitionTask |
acquisitionTask
The task used to launch a new acquisition.
|
static String |
CLASS_NAME
The property name for the acquisition handler class name.
|
private Destination |
destination
The acquisition queue or topic using this module.
|
private long |
expiration
The duration of produced messages.
|
static 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 |
isExpirationSet
true if the expiration property has been set. |
private boolean |
isPersistencySet
true if the persistence property has been set. |
private boolean |
isPersistent
Tells if the messages produced are persistent.
|
private boolean |
isPrioritySet
true if the priority property has been set. |
static org.objectweb.util.monolog.api.Logger |
logger |
private long |
period
The period before subsequent acquisition if positive.
|
static String |
PERIOD
The property name for the acquisition period.
|
static 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 String |
PRIORITY_PROPERTY
Priority property name: tells the JMS priority of produced messages.
|
private boolean |
running
true if the acquisition daemon is running. |
private long |
transmitCounter
The number of transmitted messages
|
Constructor and Description |
---|
AcquisitionModule(Destination destination,
String className,
Properties properties) |
Modifier and Type | Method and Description |
---|---|
ClientMessages |
acquisitionNot(AcquisitionNot not,
long msgCount) |
static void |
checkAcquisitionClass(String className)
Verify that one and only one correct interface is implemented.
|
void |
close()
Closes the handler.
|
long |
getCount()
Returns the number of transmitted messages
Be careful this counter is reseted at each time the server starts.
|
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.
|
void |
processMessages(ClientMessages cm)
In request mode (period <= 0), a message received on the acquisition
destination will launch an acquisition process.
|
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(List messages,
long msgCount) |
void |
setPriority(int priority)
Sets the priority of produced messages.
|
void |
setProperties(Properties properties)
Resets the acquisition properties.
|
Properties |
startHandler(Properties prop)
Start the daemon.
|
protected Properties |
stopHandler(Properties prop)
Stop the daemon.
|
private static Properties |
transform(Properties properties) |
void |
transmit(List messages,
boolean persistent)
Transmits a list of messages to the MOM in a reliable way: if persistent
is set to true the messages have been persisted when the method returns and
therefore can be safely acknowledged.
|
void |
transmit(Message message,
String messageId)
Transmits a message to the MOM in a reliable way: if the message is
persistent it has been persisted when the method returns and therefore
can be safely acknowledged.
|
public static org.objectweb.util.monolog.api.Logger logger
public static final String PERIOD
public static final String CLASS_NAME
public static final String PERSISTENT_PROPERTY
public static final String EXPIRATION_PROPERTY
public static final String PRIORITY_PROPERTY
protected Object acquisitionHandler
private int priority
private boolean isPrioritySet
true
if the priority property has been set.private boolean isPersistent
private boolean isPersistencySet
true
if the persistence property has been set.private long expiration
private boolean isExpirationSet
true
if the expiration property has been set.private final Destination destination
private long period
private AcquisitionModule.AcquisitionTask acquisitionTask
private boolean isDaemon
private boolean running
true
if the acquisition daemon is running.private volatile long transmitCounter
public AcquisitionModule(Destination destination, String className, Properties properties)
public static void checkAcquisitionClass(String className) throws Exception
Exception
private static Properties transform(Properties properties)
public boolean isMessagePersistent()
public void setMessagePersistent(boolean isPersistent)
isPersistent
- if true the messages produced are persistent.public int getPriority()
public void setPriority(int priority)
priority
- the priority to set.public long getExpiration()
public void setExpiration(long expiration)
expiration
- the expiration to set.public long getCount()
public void setProperties(Properties properties)
public void processMessages(ClientMessages cm)
public Properties startHandler(Properties prop) throws Exception
prop
- properties for start if neededException
protected Properties stopHandler(Properties prop) throws Exception
prop
- properties for stop if neededException
public ClientMessages acquisitionNot(AcquisitionNot not, long msgCount)
private void setMessagesInfo(List messages, long msgCount)
public void close()
public void transmit(Message message, String messageId)
null
if such duplicates are tolerated.transmit
in interface ReliableTransmitter
message
- the message to transmitmessageId
- the unique ID of the transmitted messageReliableTransmitter
public void transmit(List messages, boolean persistent)
transmit
in interface ReliableTransmitter
messages
- the list of messages to transmitpersistent
- true if the message must be persisted.ReliableTransmitter
public long getPeriod()
Copyright © 2016 ScalAgent D.T.. All Rights Reserved.