int correlationId = 0;
synchronized (this) {
correlationId = ++nextId;
log.trace("Allocated next sessionId: " + correlationId);
}
Transport transport = getTransport(svc);
Receiver endpoint = transport.createReceiver(correlationId,
responseMonitor);
temporaryQueues.put(correlationId, endpoint);
log.trace("Added a queue for: " + correlationId);
// TODO HANDLE TRANSACTION
String type = null;
String subtype = null;
int len = 0;
byte[] data = null;
if (toSend != null) {
data = toSend.serialize();
type = toSend.getType();
subtype = toSend.getSubtype();
len = toSend.getLen();
}
String timeToLive = properties.getProperty("TimeToLive");
int ttl = 0;
if (timeToLive != null) {
ttl = Integer.parseInt(timeToLive) * 1000;
}
transport.getSender(svc, false).send(endpoint.getReplyTo(), (short) 0,
0, data, len, correlationId, flags, ttl, type, subtype);
if ((flags & Connection.TPNOREPLY) == Connection.TPNOREPLY) {
correlationId = 0;
}
log.debug("Returning cd: " + correlationId);