use of org.apache.activemq.transport.amqp.client.util.ClientFuture in project activemq-artemis by apache.
the class AmqpSession method close.
/**
* Close the receiver, a closed receiver will throw exceptions if any further send
* calls are made.
*
* @throws IOException if an error occurs while closing the receiver.
*/
public void close() throws IOException {
if (closed.compareAndSet(false, true)) {
final ClientFuture request = new ClientFuture();
getScheduler().execute(new Runnable() {
@Override
public void run() {
checkClosed();
close(request);
pumpToProtonTransport(request);
}
});
request.sync();
}
}
use of org.apache.activemq.transport.amqp.client.util.ClientFuture in project activemq-artemis by apache.
the class AmqpSession method createMulticastReceiver.
/**
* Create a receiver instance using the given Source
*
* @param source the caller created and configured Source used to create the receiver link.
* @return a newly created receiver that is ready for use.
* @throws Exception if an error occurs while creating the receiver.
*/
public AmqpReceiver createMulticastReceiver(Source source, String receiverId, String receiveName) throws Exception {
checkClosed();
final ClientFuture request = new ClientFuture();
final AmqpReceiver receiver = new AmqpReceiver(AmqpSession.this, source, receiverId);
receiver.setSubscriptionName(receiveName);
connection.getScheduler().execute(new Runnable() {
@Override
public void run() {
checkClosed();
receiver.setStateInspector(getStateInspector());
receiver.open(request);
pumpToProtonTransport(request);
}
});
request.sync();
return receiver;
}
use of org.apache.activemq.transport.amqp.client.util.ClientFuture in project activemq-artemis by apache.
the class AmqpSession method createReceiver.
/**
* Create a receiver instance using the given Source
*
* @param source the caller created and configured Source used to create the receiver link.
* @param receiverId the receiver id to use.
* @return a newly created receiver that is ready for use.
* @throws Exception if an error occurs while creating the receiver.
*/
public AmqpReceiver createReceiver(Source source, String receiverId) throws Exception {
checkClosed();
final ClientFuture request = new ClientFuture();
final AmqpReceiver receiver = new AmqpReceiver(AmqpSession.this, source, receiverId);
connection.getScheduler().execute(new Runnable() {
@Override
public void run() {
checkClosed();
receiver.setStateInspector(getStateInspector());
receiver.open(request);
pumpToProtonTransport(request);
}
});
request.sync();
return receiver;
}
use of org.apache.activemq.transport.amqp.client.util.ClientFuture in project activemq-artemis by apache.
the class AmqpSession method createMulticastReceiver.
/**
* Create a receiver instance using the given Source
*
* @param source the caller created and configured Source used to create the receiver link.
* @return a newly created receiver that is ready for use.
* @throws Exception if an error occurs while creating the receiver.
*/
public AmqpReceiver createMulticastReceiver(String receiverId, String address, String receiveName) throws Exception {
checkClosed();
final ClientFuture request = new ClientFuture();
final AmqpReceiver receiver = new AmqpReceiver(AmqpSession.this, address, receiverId);
receiver.setSubscriptionName(receiveName);
connection.getScheduler().execute(new Runnable() {
@Override
public void run() {
checkClosed();
receiver.setStateInspector(getStateInspector());
receiver.open(request);
pumpToProtonTransport(request);
}
});
request.sync();
return receiver;
}
use of org.apache.activemq.transport.amqp.client.util.ClientFuture in project activemq-artemis by apache.
the class AmqpSession method createReceiver.
/**
* Create a receiver instance using the given address
*
* @param address the address to which the receiver will subscribe for its messages.
* @param selector the JMS selector to use for the subscription
* @param noLocal should the subscription have messages from its connection filtered.
* @param presettle should the receiver be created with a settled sender mode.
* @return a newly created receiver that is ready for use.
* @throws Exception if an error occurs while creating the receiver.
*/
public AmqpReceiver createReceiver(String address, String selector, boolean noLocal, boolean presettle) throws Exception {
checkClosed();
final ClientFuture request = new ClientFuture();
final AmqpReceiver receiver = new AmqpReceiver(AmqpSession.this, address, getNextReceiverId());
receiver.setNoLocal(noLocal);
receiver.setPresettle(presettle);
if (selector != null && !selector.isEmpty()) {
receiver.setSelector(selector);
}
connection.getScheduler().execute(new Runnable() {
@Override
public void run() {
checkClosed();
receiver.setStateInspector(getStateInspector());
receiver.open(request);
pumpToProtonTransport(request);
}
});
request.sync();
return receiver;
}
Aggregations