use of org.apache.activemq.artemis.protocol.amqp.client.ProtonClientSenderContext in project activemq-artemis by apache.
the class AMQPSessionContext method addSender.
public void addSender(Sender sender) throws Exception {
// TODO: Remove this check when we have support for global link names
boolean outgoing = (sender.getContext() != null && sender.getContext().equals(true));
ProtonServerSenderContext protonSender = outgoing ? new ProtonClientSenderContext(connection, sender, this, sessionSPI) : new ProtonServerSenderContext(connection, sender, this, sessionSPI);
try {
protonSender.initialise();
senders.put(sender, protonSender);
serverSenders.put(protonSender.getBrokerConsumer(), protonSender);
sender.setContext(protonSender);
connection.lock();
try {
sender.open();
} finally {
connection.unlock();
}
protonSender.start();
} catch (ActiveMQAMQPException e) {
senders.remove(sender);
sender.setSource(null);
sender.setCondition(new ErrorCondition(e.getAmqpError(), e.getMessage()));
connection.lock();
try {
sender.close();
} finally {
connection.unlock();
}
}
}
Aggregations