private AtomicInteger count = new AtomicInteger();
@Override
public void run() {
Message message = session.createTextMessage("hello world! " + String.valueOf(count.incrementAndGet()));
message.setAddress("amqp://joze/rq-src");
String reply_to = "amqp://" + container + "/" + address;
message.setReplyTo(reply_to);
message.setCorrelationId("correlator");
final MessageDelivery md = sender.send(message);
md.onRemoteStateChange(new Callback<DeliveryState>() {
@Override
public void onSuccess(DeliveryState value) {
_logger.fine("delivery remote state change! " + str(value) +
" local: "+ str(md.getLocalState()) +
" remote: " + str(md.getRemoteState()));
}
@Override
public void onFailure(Throwable value) {
_logger.fine("remote state change Trouble!" + str(value));
conn.close();
}
});
md.onSettle(new Callback<DeliveryState>() {
@Override
public void onSuccess(DeliveryState value) {
_logger.fine("delivery settled! " + str(value) +
" local: "+ str(md.getLocalState()) +
" remote: " + str(md.getRemoteState()));
_logger.fine("sender settle mode state " +
" local receiver " + str(sender.getEndpoint().getReceiverSettleMode()) +
" local sender " + str(sender.getEndpoint().getSenderSettleMode()) +
" remote receiver " + str(sender.getEndpoint().getRemoteReceiverSettleMode()) +
" remote sender " + str(sender.getEndpoint().getRemoteSenderSettleMode()) +
""
);
}
@Override
public void onFailure(Throwable value) {
_logger.fine("delivery sending Trouble!" + str(value));
conn.close();
}
});
}
};
receiver.setDeliveryListener(new AmqpDeliveryListener() {
@Override
public void onMessageDelivery(
MessageDelivery delivery) {
Message message = delivery.getMessage();
_logger.fine("incoming message delivery! " +
" local " + str(delivery.getLocalState()) +
" remote " + str(delivery.getRemoteState()) +
" message " + str(message.getBody()) +
"");
delivery.onSettle(new Callback<DeliveryState>() {
@Override
public void onSuccess(DeliveryState value) {