Class RESTDistribution
- java.lang.Object
-
- com.scalagent.joram.mom.dest.rest.RESTDistribution
-
- All Implemented Interfaces:
DistributionHandler
public final class RESTDistribution extends Object implements DistributionHandler
Distribution handler for the REST distribution bridge.
-
-
Field Summary
Fields Modifier and Type Field Description static StringBytesMessageprivate jakarta.ws.rs.client.Clientclientprivate StringclientIdprivate intconnectTimeoutprivate static booleanDEBUGprivate StringdestNameprivate StringhostNameprivate StringidleTimeoutprivate static Loggerloggerstatic StringMapMessageprivate Stringpasswordprivate intportprivate StringprodNameprivate Propertiespropertiesprivate intreadTimeoutstatic StringTextMessageprivate URIuriCloseProducerprivate URIuriSendNextMsgprivate booleanuseOldAPIprivate StringuserName
-
Constructor Summary
Constructors Constructor Description RESTDistribution()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the Rest/JMS producer and all associated resources.private voidcloseProducer()Close the producer.private voidcreateProducer(String userName, String password)voiddistribute(Message fullMessage)Distributes the given message outside of the JORAM server.private Map<String,Object>getMapMessageToJsonBodyMap(Message fullMessage)voidinit(Properties properties, boolean firstTime)Configures the handler with the given properties.private voidsendNextMessage(Message fullMessage)
-
-
-
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
-
destName
private String destName
-
idleTimeout
private String idleTimeout
-
prodName
private String prodName
-
clientId
private String clientId
-
client
private jakarta.ws.rs.client.Client client
-
uriSendNextMsg
private URI uriSendNextMsg
-
uriCloseProducer
private URI uriCloseProducer
-
BytesMessage
public static final String BytesMessage
- See Also:
- Constant Field Values
-
MapMessage
public static final String MapMessage
- See Also:
- Constant Field Values
-
TextMessage
public static final String TextMessage
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(Properties properties, boolean firstTime)
Description copied from interface:DistributionHandlerConfigures the handler with the given properties.- Specified by:
initin interfaceDistributionHandler- Parameters:
properties- The initial set of properties.
-
createProducer
private void createProducer(String userName, String password) throws Exception
- Throws:
Exception
-
distribute
public void distribute(Message fullMessage) throws Exception
Description copied from interface:DistributionHandlerDistributes the given message outside of the JORAM server.- Specified by:
distributein interfaceDistributionHandler- Parameters:
fullMessage- the message to distribute- Throws:
Exception- if the message could not be distributed. The message will be forwarded to a DMQ, if any.
-
getMapMessageToJsonBodyMap
private Map<String,Object> getMapMessageToJsonBodyMap(Message fullMessage) throws MessageFormatException
- Throws:
MessageFormatException
-
sendNextMessage
private void sendNextMessage(Message fullMessage) throws Exception
- Throws:
Exception
-
closeProducer
private void closeProducer()
Close the producer.
-
close
public void close()
Closes the Rest/JMS producer and all associated resources. Called by generic behavior during the destination finalization.- Specified by:
closein interfaceDistributionHandler
-
-