use of com.ing.ifsa.IFSAServiceName in project iaf by ibissource.
the class PullingIfsaProviderListener method open.
public void open() throws ListenerException {
try {
openService();
IFSAServicesProvided services = getServiceQueue().getIFSAServicesProvided();
for (int i = 0; i < services.getNumberOfServices(); i++) {
IFSAServiceName service = services.getService(i);
String protocol = (service.IsFireAndForgetService() ? "Fire and Forget" : "Request/Reply");
log.info(getLogPrefix() + "providing ServiceName [" + service.getServiceName() + "] ServiceGroup [" + service.getServiceGroup() + "] protocol [" + protocol + "] ServiceVersion [" + service.getServiceVersion() + "]");
}
} catch (Exception e) {
throw new ListenerException(getLogPrefix(), e);
}
}
use of com.ing.ifsa.IFSAServiceName in project iaf by ibissource.
the class PullingIfsaProviderListener method getIdFromRawMessage.
/**
* Extracts ID-string from message obtained from {@link #getRawMessage(Map)}.
* Puts also the following parameters in the threadContext:
* <ul>
* <li>id</li>
* <li>cid</li>
* <li>timestamp</li>
* <li>replyTo</li>
* <li>messageText</li>
* <li>fullIfsaServiceName</li>
* <li>ifsaServiceName</li>
* <li>ifsaGroup</li>
* <li>ifsaOccurrence</li>
* <li>ifsaVersion</li>
* </ul>
* @return ID-string of message for adapter.
*/
public String getIdFromRawMessage(Object rawMessage, Map threadContext) throws ListenerException {
IFSAMessage message = null;
if (rawMessage instanceof IMessageWrapper) {
return getIdFromWrapper((IMessageWrapper) rawMessage, threadContext);
}
try {
message = (IFSAMessage) rawMessage;
} catch (ClassCastException e) {
log.error(getLogPrefix() + "message received was not of type IFSAMessage, but [" + rawMessage.getClass().getName() + "]", e);
return null;
}
String mode = "unknown";
String id = "unset";
String cid = "unset";
Date tsSent = null;
Destination replyTo = null;
String messageText = null;
String fullIfsaServiceName = null;
IFSAServiceName requestedService = null;
String ifsaServiceName = null, ifsaGroup = null, ifsaOccurrence = null, ifsaVersion = null;
try {
if (message.getJMSDeliveryMode() == DeliveryMode.NON_PERSISTENT) {
mode = "NON_PERSISTENT";
} else if (message.getJMSDeliveryMode() == DeliveryMode.PERSISTENT) {
mode = "PERSISTENT";
}
} catch (JMSException ignore) {
}
// --------------------------
try {
id = message.getJMSMessageID();
} catch (JMSException ignore) {
}
// --------------------------
try {
cid = message.getJMSCorrelationID();
if (cid == null) {
cid = id;
log.debug("Setting correlation ID to MessageId");
}
} catch (JMSException ignore) {
}
// --------------------------
try {
long lTimeStamp = message.getJMSTimestamp();
tsSent = new Date(lTimeStamp);
} catch (JMSException ignore) {
}
// --------------------------
try {
replyTo = message.getJMSReplyTo();
} catch (JMSException ignore) {
}
// --------------------------
try {
messageText = ((TextMessage) message).getText();
} catch (Throwable ignore) {
}
// --------------------------
try {
fullIfsaServiceName = message.getServiceString();
requestedService = message.getService();
ifsaServiceName = requestedService.getServiceName();
ifsaGroup = requestedService.getServiceGroup();
ifsaOccurrence = requestedService.getServiceOccurance();
ifsaVersion = requestedService.getServiceVersion();
} catch (JMSException e) {
log.error(getLogPrefix() + "got error getting serviceparameter", e);
}
if (log.isDebugEnabled()) {
log.debug(getLogPrefix() + "got message for [" + fullIfsaServiceName + "] with JMSDeliveryMode=[" + mode + "] \n JMSMessageID=[" + id + "] \n JMSCorrelationID=[" + cid + "] \n ifsaServiceName=[" + ifsaServiceName + "] \n ifsaGroup=[" + ifsaGroup + "] \n ifsaOccurrence=[" + ifsaOccurrence + "] \n ifsaVersion=[" + ifsaVersion + "] \n Timestamp Sent=[" + DateUtils.format(tsSent) + "] \n ReplyTo=[" + ((replyTo == null) ? "none" : replyTo.toString()) + "] \n MessageHeaders=[" + displayHeaders(message) + "\n" + "] \n Message=[" + message.toString() + "\n]");
}
PipeLineSessionBase.setListenerParameters(threadContext, id, cid, null, tsSent);
threadContext.put("timestamp", tsSent);
threadContext.put("replyTo", ((replyTo == null) ? "none" : replyTo.toString()));
threadContext.put("messageText", messageText);
threadContext.put("fullIfsaServiceName", fullIfsaServiceName);
threadContext.put("ifsaServiceName", ifsaServiceName);
threadContext.put("ifsaGroup", ifsaGroup);
threadContext.put("ifsaOccurrence", ifsaOccurrence);
threadContext.put("ifsaVersion", ifsaVersion);
Map udz = (Map) message.getIncomingUDZObject();
if (udz != null) {
String contextDump = "ifsaUDZ:";
for (Iterator it = udz.keySet().iterator(); it.hasNext(); ) {
String key = (String) it.next();
String value = (String) udz.get(key);
contextDump = contextDump + "\n " + key + "=[" + value + "]";
threadContext.put(key, value);
}
if (log.isDebugEnabled()) {
log.debug(getLogPrefix() + contextDump);
}
}
return id;
}
use of com.ing.ifsa.IFSAServiceName in project iaf by ibissource.
the class PushingIfsaProviderListener method getIdFromRawMessage.
/**
* Extracts ID-string from message obtained from {@link #getRawMessage(Map)}.
* Puts also the following parameters in the threadContext:
* <ul>
* <li>id</li>
* <li>cid</li>
* <li>timestamp</li>
* <li>replyTo</li>
* <li>messageText</li>
* <li>fullIfsaServiceName</li>
* <li>ifsaServiceName</li>
* <li>ifsaGroup</li>
* <li>ifsaOccurrence</li>
* <li>ifsaVersion</li>
* <li>ifsaBifName</li>
* <li>ifsaBtcData</li>
* </ul>
* @return ID-string of message for adapter.
*/
public String getIdFromRawMessage(Object rawMessage, Map threadContext) throws ListenerException {
IFSAMessage message = null;
if (rawMessage instanceof IMessageWrapper) {
return getIdFromWrapper((IMessageWrapper) rawMessage, threadContext);
}
try {
message = (IFSAMessage) rawMessage;
} catch (ClassCastException e) {
log.error(getLogPrefix() + "message received was not of type IFSAMessage, but [" + rawMessage.getClass().getName() + "]", e);
return null;
}
String mode = "unknown";
String id = "unset";
String cid = "unset";
Date tsSent = null;
Destination replyTo = null;
String messageText = null;
String fullIfsaServiceName = null;
IFSAServiceName requestedService = null;
String ifsaServiceName = null, ifsaGroup = null, ifsaOccurrence = null, ifsaVersion = null;
try {
if (message.getJMSDeliveryMode() == DeliveryMode.NON_PERSISTENT) {
mode = "NON_PERSISTENT";
} else if (message.getJMSDeliveryMode() == DeliveryMode.PERSISTENT) {
mode = "PERSISTENT";
}
} catch (JMSException ignore) {
}
// --------------------------
try {
id = message.getJMSMessageID();
} catch (JMSException ignore) {
}
// --------------------------
try {
cid = message.getJMSCorrelationID();
} catch (JMSException ignore) {
}
// --------------------------
try {
long lTimeStamp = message.getJMSTimestamp();
tsSent = new Date(lTimeStamp);
} catch (JMSException ignore) {
}
// --------------------------
try {
replyTo = message.getJMSReplyTo();
} catch (JMSException ignore) {
}
// --------------------------
try {
messageText = ((TextMessage) message).getText();
} catch (Throwable ignore) {
}
// --------------------------
try {
fullIfsaServiceName = message.getServiceString();
requestedService = message.getService();
ifsaServiceName = requestedService.getServiceName();
ifsaGroup = requestedService.getServiceGroup();
ifsaOccurrence = requestedService.getServiceOccurance();
ifsaVersion = requestedService.getServiceVersion();
} catch (JMSException e) {
log.error(getLogPrefix() + "got error getting serviceparameter", e);
}
String BIFname = null;
try {
BIFname = message.getBifName();
if (StringUtils.isNotEmpty(BIFname)) {
threadContext.put(THREAD_CONTEXT_BIFNAME_KEY, BIFname);
}
} catch (JMSException e) {
log.error(getLogPrefix() + "got error getting BIFname", e);
}
byte[] btcData = null;
try {
btcData = message.getBtcData();
} catch (JMSException e) {
log.error(getLogPrefix() + "got error getting btcData", e);
}
if (log.isDebugEnabled()) {
log.debug(getLogPrefix() + "got message for [" + fullIfsaServiceName + "] with JMSDeliveryMode=[" + mode + "] \n JMSMessageID=[" + id + "] \n JMSCorrelationID=[" + cid + "] \n BIFname=[" + BIFname + "] \n ifsaServiceName=[" + ifsaServiceName + "] \n ifsaGroup=[" + ifsaGroup + "] \n ifsaOccurrence=[" + ifsaOccurrence + "] \n ifsaVersion=[" + ifsaVersion + "] \n Timestamp Sent=[" + DateUtils.format(tsSent) + "] \n ReplyTo=[" + ((replyTo == null) ? "none" : replyTo.toString()) + "] \n MessageHeaders=[" + displayHeaders(message) + "\n" + // + "] \n btcData=["+ btcData
"] \n Message=[" + message.toString() + "\n]");
}
// if (cid == null) {
// if (StringUtils.isNotEmpty(BIFname)) {
// cid = BIFname;
// if (log.isDebugEnabled()) log.debug("Setting correlation ID to BIFname ["+cid+"]");
// } else {
// cid = id;
// if (log.isDebugEnabled()) log.debug("Setting correlation ID to MessageId ["+cid+"]");
// }
// }
PipeLineSessionBase.setListenerParameters(threadContext, id, BIFname, null, tsSent);
threadContext.put("timestamp", tsSent);
threadContext.put("replyTo", ((replyTo == null) ? "none" : replyTo.toString()));
threadContext.put("messageText", messageText);
threadContext.put("fullIfsaServiceName", fullIfsaServiceName);
threadContext.put("ifsaServiceName", ifsaServiceName);
threadContext.put("ifsaGroup", ifsaGroup);
threadContext.put("ifsaOccurrence", ifsaOccurrence);
threadContext.put("ifsaVersion", ifsaVersion);
threadContext.put("ifsaBifName", BIFname);
threadContext.put("ifsaBtcData", btcData);
Map udz = (Map) message.getIncomingUDZObject();
if (udz != null) {
String contextDump = "ifsaUDZ:";
for (Iterator it = udz.keySet().iterator(); it.hasNext(); ) {
String key = (String) it.next();
String value = (String) udz.get(key);
contextDump = contextDump + "\n " + key + "=[" + value + "]";
threadContext.put(key, value);
}
if (log.isDebugEnabled()) {
log.debug(getLogPrefix() + contextDump);
}
}
return BIFname;
}
use of com.ing.ifsa.IFSAServiceName in project iaf by ibissource.
the class PushingIfsaProviderListener method open.
public void open() throws ListenerException {
try {
openService();
IFSAServicesProvided services = getServiceQueue().getIFSAServicesProvided();
for (int i = 0; i < services.getNumberOfServices(); i++) {
IFSAServiceName service = services.getService(i);
String protocol = (service.IsFireAndForgetService() ? "Fire and Forget" : "Request/Reply");
log.info(getLogPrefix() + "providing ServiceName [" + service.getServiceName() + "] ServiceGroup [" + service.getServiceGroup() + "] protocol [" + protocol + "] ServiceVersion [" + service.getServiceVersion() + "]");
}
jmsConnector.start();
} catch (Exception e) {
throw new ListenerException(getLogPrefix(), e);
}
}
Aggregations