use of com.swiftmq.amqp.v100.generated.messaging.delivery_state.DeliveryStateIF in project swiftmq-ce by iitsoftware.
the class TransactionRegistry method addToTransaction.
private void addToTransaction(String txnId, long deliveryId, DeliveryStateIF deliveryStateIF) throws EndWithErrorException {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + "/addToTransaction, txnId=" + txnId + ", deliveryId=" + deliveryId + ", deliveryStateIF=" + deliveryStateIF);
lock.lock();
try {
ActiveTxEntry activeTxEntry = (ActiveTxEntry) activeTx.get(txnId);
if (activeTxEntry == null) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + "/addToTransaction, txnId=" + txnId + ", not found!");
throw new SessionEndException(TransactionError.UNKNOWN_ID, new AMQPString("Transaction id not found: " + txnId));
}
if (activeTxEntry.outboundTxEntryMap == null)
activeTxEntry.outboundTxEntryMap = new HashMap();
OutboundTxEntry outboundTxEntry = (OutboundTxEntry) activeTxEntry.outboundTxEntryMap.get(deliveryId);
if (outboundTxEntry == null) {
outboundTxEntry = new OutboundTxEntry(null, null, deliveryStateIF);
activeTxEntry.outboundTxEntryMap.put(deliveryId, outboundTxEntry);
} else
outboundTxEntry.deliveryStateIF = deliveryStateIF;
} finally {
lock.unlock();
}
}
use of com.swiftmq.amqp.v100.generated.messaging.delivery_state.DeliveryStateIF in project swiftmq-client by iitsoftware.
the class TransactionController method discharge.
private synchronized void discharge(TxnIdIF txnId, boolean fail) throws AMQPException {
AMQPMessage msg = new AMQPMessage();
Discharge discharge = new Discharge();
discharge.setTxnId(txnId);
discharge.setFail(new AMQPBoolean(fail));
msg.setAmqpValue(new AmqpValue(discharge));
DeliveryStateIF deliveryState = producer.send(msg);
if (deliveryState instanceof Rejected) {
Rejected rejected = (Rejected) deliveryState;
com.swiftmq.amqp.v100.generated.transport.definitions.Error error = rejected.getError();
if (error != null)
throw new AMQPException(error.getValueString());
else
throw new AMQPException(("Unknown transactiom error"));
}
}
Aggregations