use of com.swiftmq.amqp.v100.generated.messaging.delivery_state.Accepted in project swiftmq-client by iitsoftware.
the class Producer method recover.
protected void recover(AMQPMap remoteUnsettled) {
try {
if (remoteUnsettled != null) {
Map<AMQPType, AMQPType> map = remoteUnsettled.getValue();
for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
final DeliveryTag deliveryTag = new DeliveryTag(((AMQPBinary) entry.getKey()).getValue());
final AMQPList deliveryState = (AMQPList) entry.getValue();
if (deliveryState != null) {
try {
DeliveryStateFactory.create(deliveryState).accept(new DeliveryStateVisitorAdapter() {
public void visit(Accepted impl) {
deliveryMemory.deliverySettled(deliveryTag);
mySession.dispatch(new POSendResumedTransfer(Producer.this, deliveryTag));
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
if (deliveryMemory.getNumberUnsettled() > 0) {
Collection<UnsettledDelivery> unsettled = deliveryMemory.getUnsettled();
for (Iterator<UnsettledDelivery> iter = unsettled.iterator(); iter.hasNext(); ) {
UnsettledDelivery unsettledDelivery = iter.next();
if (unsettledDelivery.getMessage() != null) {
AMQPMessage msg = unsettledDelivery.getMessage();
if (msg.getTxnIdIF() == null) {
POSendMessage po = new POSendMessage(null, this, msg, null, unsettledDelivery.getDeliveryTag());
po.setRecovery(true);
mySession.dispatch(po);
}
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
use of com.swiftmq.amqp.v100.generated.messaging.delivery_state.Accepted in project swiftmq-ce by iitsoftware.
the class TargetLink method getLastDeliveryState.
public DeliveryStateIF getLastDeliveryState() {
if (coordinator) {
DeliveryStateIF ds = lastDeliveryState;
lastDeliveryState = null;
return ds;
}
return new Accepted();
}
use of com.swiftmq.amqp.v100.generated.messaging.delivery_state.Accepted in project swiftmq-client by iitsoftware.
the class SessionDispatcher method visit.
public void visit(POSendResumedTransfer po) {
if (pTracer.isEnabled())
pTracer.trace(toString(), ", visit, po=" + po + " ...");
TransferFrame frame = new TransferFrame(mySession.getChannel());
frame.setHandle(new Handle(po.getProducer().getHandle()));
frame.setSettled(new AMQPBoolean(true));
frame.setResume(new AMQPBoolean(true));
frame.setDeliveryId(new DeliveryNumber(nextOutgoingId++));
frame.setDeliveryTag(po.getDeliveryTag());
frame.setState(new Accepted());
outboundHandler.send(frame);
if (pTracer.isEnabled())
pTracer.trace(toString(), ", visit, po=" + po + " done");
}
Aggregations