use of com.swiftmq.amqp.v100.types.AMQPBoolean in project swiftmq-client by iitsoftware.
the class AMQPRepo method remove.
AMQPRepo remove(String appname) throws Exception {
AMQPMessage request = new AMQPMessage();
Map propMap = new HashMap();
propMap.put(new AMQPString("app"), new AMQPString(appname));
propMap.put(new AMQPString("operation"), new AMQPString("remove"));
request.setApplicationProperties(new ApplicationProperties(propMap));
Properties properties = new Properties();
properties.setReplyTo(replyQueue);
request.setProperties(properties);
producer.send(request);
AMQPMessage reply = consumer.receive(TIMEOUT);
if (reply == null)
throw new Exception("Timeout occurred while waiting for a reply!");
AMQPMap body = (AMQPMap) reply.getAmqpValue().getValue();
boolean success = ((AMQPBoolean) (body.getValue().get(new AMQPString("success")))).getValue();
if (success)
System.out.println("Removed repository " + appname);
else {
String result = ((AMQPString) (body.getValue().get(new AMQPString("result")))).getValue();
System.out.println(result);
}
return this;
}
use of com.swiftmq.amqp.v100.types.AMQPBoolean 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");
}
use of com.swiftmq.amqp.v100.types.AMQPBoolean 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