Class AcquisitionModule

    • Field Detail

      • logger

        private static final Logger logger
      • DEBUG

        private static final boolean DEBUG
      • acquisitionHandler

        protected Object acquisitionHandler
        The acquisition logic.
      • priority

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

        private boolean isPrioritySet
        true if the priority property has been set.
      • isPersistent

        private boolean isPersistent
        Tells if the messages produced are persistent.
      • isPersistencySet

        private boolean isPersistencySet
        true if the persistence property has been set.
      • expiration

        private long expiration
        The duration of produced messages.
      • isExpirationSet

        private boolean isExpirationSet
        true if the expiration property has been set.
      • destination

        private final Destination destination
        The acquisition queue or topic using this module.
      • period

        private long period
        The period before subsequent acquisition if positive.
      • isDaemon

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

        private boolean running
        true if the acquisition daemon is running.
      • transmitCounter

        private AtomicLong transmitCounter
        The number of transmitted messages.
    • Method Detail

      • checkAcquisitionClass

        public static void checkAcquisitionClass​(String className)
                                          throws Exception
        Verify that one and only one correct interface is implemented.
        Throws:
        Exception
      • isRunning

        public boolean isRunning()
      • 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.
      • getCount

        public long getCount()
        Returns the number of transmitted messages Be careful this counter is reseted at each time the server starts.
        Returns:
        the number of transmitted messages
      • setProperties

        public void setProperties​(Properties properties)
        Resets the acquisition properties.
      • processMessages

        public void processMessages​(ClientMessages cm)
        In request mode (period <= 0), a message received on the acquisition destination will launch an acquisition process. If the message holds non-null properties, these properties are first transmitted to the handler.
        In other modes (periodic mode or daemon), such a message should not be received, so it is forwarded to the DMQ.
      • startHandler

        public Properties startHandler​(Properties prop)
                                throws Exception
        Start the daemon.
        Parameters:
        prop - properties for start if needed
        Returns:
        properties for the reply.
        Throws:
        Exception
      • stopHandler

        protected Properties stopHandler​(Properties prop)
                                  throws Exception
        Stop the daemon.
        Parameters:
        prop - properties for stop if needed
        Returns:
        properties for the reply.
        Throws:
        Exception
      • setMessagesInfo

        private void setMessagesInfo​(List<Message> messages,
                                     long msgCount)
      • close

        public void close()
        Closes the handler.
      • transmit

        public 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. 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
        See Also:
        ReliableTransmitter
      • transmit

        public void transmit​(List<Message> 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. Be careful, the use of this transmit method does not allow to verify the duplication of messages.
        Specified by:
        transmit in interface ReliableTransmitter
        Parameters:
        messages - the list of messages to transmit
        persistent - true if the message must be persisted.
        See Also:
        ReliableTransmitter
      • getPeriod

        public long getPeriod()