Class RESTAcquisition
- java.lang.Object
-
- com.scalagent.joram.mom.dest.rest.RESTAcquisition
-
- All Implemented Interfaces:
AcquisitionHandler
public final class RESTAcquisition extends Object implements AcquisitionHandler
Simple acquisition handler for the REST acquisition bridge. A Rest/JMS acquisition request is triggered each time a new message is received. If this message contains properties, the module is reinitialized with the incoming properties.
-
-
Field Summary
Fields Modifier and Type Field Description private jakarta.ws.rs.client.Clientclientprivate intconnectTimeoutprivate static booleanDEBUGprivate StringdestNameprivate StringhostNameprivate StringidleTimeoutprivate static Loggerloggerprivate booleanmediaTypeJsonprivate intnbMaxMsgprivate Stringpasswordprivate booleanpersistentprivate intportprivate Propertiespropertiesprivate intreadTimeoutprivate longtimeoutprivate URIuriCloseConsumerprivate URIuriConsumeprivate booleanuseOldAPIprivate StringuserName
-
Constructor Summary
Constructors Constructor Description RESTAcquisition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the Acquisition module and all associated resources.private voidcloseConsumer()Close the consumer.private voidcreateConsumer()This method is called either from init (implying initialization of the consumer), or retrieve if the consumer is not initialized.private HashMapgetMapMessage(Map<String,Object> jsonMap)private voidinit(Properties properties)voidretrieve(ReliableTransmitter transmitter)Retrieves one or more message from an external source (e-mail, ftp, ...).private voidsetMessageHeader(Map jsonMessageHeader, Message message)voidsetProperties(Properties properties)Configures the handler with the given properties.
-
-
-
Field Detail
-
logger
private static final Logger logger
-
DEBUG
private static final boolean DEBUG
-
properties
private Properties properties
-
hostName
private String hostName
-
port
private int port
-
useOldAPI
private boolean useOldAPI
-
connectTimeout
private int connectTimeout
-
readTimeout
private int readTimeout
-
userName
private String userName
-
password
private String password
-
idleTimeout
private String idleTimeout
-
timeout
private long timeout
-
persistent
private boolean persistent
-
nbMaxMsg
private int nbMaxMsg
-
mediaTypeJson
private boolean mediaTypeJson
-
destName
private String destName
-
uriConsume
private URI uriConsume
-
uriCloseConsumer
private URI uriCloseConsumer
-
client
private jakarta.ws.rs.client.Client client
-
-
Method Detail
-
init
private void init(Properties properties)
-
createConsumer
private void createConsumer() throws ExceptionThis method is called either from init (implying initialization of the consumer), or retrieve if the consumer is not initialized.- Throws:
Exception
-
getMapMessage
private HashMap getMapMessage(Map<String,Object> jsonMap) throws Exception
- Throws:
Exception
-
retrieve
public void retrieve(ReliableTransmitter transmitter) throws Exception
Description copied from interface:AcquisitionHandlerRetrieves one or more message from an external source (e-mail, ftp, ...). Message properties such as priority, expiration or persistence will be set afterwards by theAcquisitionModule.
If the external source is reliable, acknowledgment can be done safely after transmitting the message using the transmitter.- Specified by:
retrievein interfaceAcquisitionHandler- Parameters:
transmitter- a transmitter used to transmit retrieved messages to the MOM reliably.- Throws:
Exception
-
setProperties
public void setProperties(Properties properties)
Description copied from interface:AcquisitionHandlerConfigures the handler with the given properties. This method is called one time before the first call to retrieve and then when the acquisition destination receives a configuration message.- Specified by:
setPropertiesin interfaceAcquisitionHandler- Parameters:
properties- The new set of properties.
-
closeConsumer
private void closeConsumer()
Close the consumer.
-
close
public void close()
Closes the Acquisition module and all associated resources. Called by generic behavior during the destination finalization.- Specified by:
closein interfaceAcquisitionHandler
-
-