use of nl.nn.adapterframework.extensions.ifsa.IfsaException in project iaf by ibissource.
the class IfsaFacade method getMessagingSource.
protected IfsaMessagingSource getMessagingSource() throws IfsaException {
if (messagingSource == null) {
synchronized (this) {
if (messagingSource == null) {
log.debug(getLogPrefix() + "instantiating IfsaConnectionFactory");
IfsaMessagingSourceFactory ifsaConnectionFactory = new IfsaMessagingSourceFactory();
try {
log.debug(getLogPrefix() + "creating IfsaConnection");
messagingSource = (IfsaMessagingSource) ifsaConnectionFactory.getConnection(getApplicationId());
} catch (IbisException e) {
if (e instanceof IfsaException) {
throw (IfsaException) e;
}
throw new IfsaException(e);
}
}
}
}
return messagingSource;
}
use of nl.nn.adapterframework.extensions.ifsa.IfsaException in project iaf by ibissource.
the class IfsaFacade method closeService.
/**
* Stops communication on the IFSA bus.
* Releases references to serviceQueue and connection.
*/
public void closeService() throws IfsaException {
try {
if (messagingSource != null) {
try {
messagingSource.close();
} catch (IbisException e) {
if (e instanceof IfsaException) {
throw (IfsaException) e;
}
throw new IfsaException(e);
}
log.debug(getLogPrefix() + "closed connection for service");
}
} finally {
// make sure all objects are reset, to be able to restart after IFSA parameters have changed (e.g. at iterative installation time)
queue = null;
messagingSource = null;
}
}
use of nl.nn.adapterframework.extensions.ifsa.IfsaException in project iaf by ibissource.
the class IfsaFacade method sendReply.
/**
* Intended for server-side reponse sending and implies that the received
* message *always* contains a reply-to address.
*/
public void sendReply(QueueSession session, Message received_message, String response) throws IfsaException {
QueueSender tqs = null;
try {
TextMessage answer = session.createTextMessage();
answer.setText(response);
Queue replyQueue = (Queue) received_message.getJMSReplyTo();
tqs = session.createSender(replyQueue);
if (log.isDebugEnabled())
log.debug(getLogPrefix() + "sending reply to [" + received_message.getJMSReplyTo() + "]");
((IFSAServerQueueSender) tqs).sendReply(received_message, answer);
} catch (Throwable t) {
throw new IfsaException(t);
} finally {
if (tqs != null) {
try {
tqs.close();
} catch (JMSException e) {
log.warn(getLogPrefix() + "exception closing reply queue sender", e);
}
}
}
}
use of nl.nn.adapterframework.extensions.ifsa.IfsaException in project iaf by ibissource.
the class IfsaMessagingSource method closeReplyReceiver.
public void closeReplyReceiver(QueueReceiver receiver) throws IfsaException {
try {
if (receiver != null) {
Queue replyQueue = receiver.getQueue();
receiver.close();
releaseClientReplyQueue(replyQueue);
}
} catch (JMSException e) {
throw new IfsaException(e);
}
}
use of nl.nn.adapterframework.extensions.ifsa.IfsaException in project iaf by ibissource.
the class IfsaMessagingSource method getClientReplyQueue.
/**
* Retrieves the reply queue for a <b>client</b> connection. If the
* client is transactional the replyqueue is retrieved from IFSA,
* otherwise a temporary (dynamic) queue is created.
*/
public Queue getClientReplyQueue(QueueSession session) throws IfsaException {
Queue replyQueue = null;
try {
/*
* if we don't know if we're using a dynamic reply queue, we can
* check this using the function IsClientTransactional
* Yes -> we're using a static reply queue
* No -> dynamic reply queue
*/
if (hasDynamicReplyQueue()) {
// Temporary Dynamic
replyQueue = getDynamicReplyQueue(session);
log.debug("got dynamic reply queue [" + replyQueue.getQueueName() + "]");
} else {
// Static
replyQueue = (Queue) ((IFSAContext) getContext()).lookupReply(getId());
log.debug("got static reply queue [" + replyQueue.getQueueName() + "]");
}
return replyQueue;
} catch (Exception e) {
throw new IfsaException(e);
}
}
Aggregations