/** * Closes the ClientRequestor and its session. * * @throws Exception if an exception occurs while closing the ClientRequestor */ @Override public void close() throws Exception { replyConsumer.close(); requestProducer.close(); queueSession.deleteQueue(replyQueue); }
public ActiveMQConnectionFactory(final boolean ha, final DiscoveryGroupConfiguration groupConfiguration) { if (ha) { serverLocator = ActiveMQClient.createServerLocatorWithHA(groupConfiguration); } else { serverLocator = ActiveMQClient.createServerLocatorWithoutHA(groupConfiguration); } serverLocator.disableFinalizeCheck(); }
/** * Sends a message to the request address and wait for the given timeout for a reply. * The temporary queue is used for the REPLYTO_HEADER_NAME, and only one reply per request is expected * * @param request the message to send * @param timeout the timeout to wait for a reply (in milliseconds) * @return the reply message or {@code null} if no message is replied before the timeout elapses * @throws Exception */ public ClientMessage request(final ClientMessage request, final long timeout) throws Exception { request.putStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME, replyQueue); requestProducer.send(request); return replyConsumer.receive(timeout); }
private void closeChildren() throws ActiveMQException { Set<ClientConsumerInternal> consumersClone = cloneConsumers(); for (ClientConsumer consumer : consumersClone) { consumer.close(); } Set<ClientProducerInternal> producersClone = cloneProducers(); for (ClientProducer producer : producersClone) { producer.close(); } }
void deleteQueue(final SimpleString queueName) throws JMSException { if (!session.isClosed()) { try { session.deleteQueue(queueName); } catch (ActiveMQException ignore) { // Exception on deleting queue shouldn't prevent close from completing } } }
@Override public void close() { ServerLocator locator0 = serverLocator; if (locator0 != null) locator0.close(); }
/** * Sends a message to the request address and wait indefinitely for a reply. * The temporary queue is used for the REPLYTO_HEADER_NAME, and only one reply per request is expected * * @param request the message to send * @return the reply message * @throws Exception */ public ClientMessage request(final ClientMessage request) throws Exception { return request(request, 0); }
@Override public void setJMSRedelivered(final boolean redelivered) throws JMSException { if (!redelivered) { message.setDeliveryCount(1); } else { if (message.getDeliveryCount() > 1) { // do nothing } else { message.setDeliveryCount(2); } } }
@Override public boolean hasMoreElements() { if (current == null) { try { current = consumer.receiveImmediate(); } catch (ActiveMQException e) { return false; } } return current != null; }
/** * Helper method for {@link #isBodyAssignableTo(Class)}. * * @return true if the message has no body. */ protected boolean hasNoBody() { return message.getBodySize() == 0; }
private void addSessionMetaData(ClientSession session) throws ActiveMQException { session.addMetaData(ClientSession.JMS_SESSION_IDENTIFIER_PROPERTY, ""); if (clientID != null) { session.addMetaData(ClientSession.JMS_SESSION_CLIENT_ID_PROPERTY, clientID); } }
@Override public void run() { failoverListener.failoverEvent(eventType); } });
public ActiveMQConnectionFactory(final ServerLocator serverLocator) { this.serverLocator = serverLocator; serverLocator.disableFinalizeCheck(); }
private void callSendAck(SendAcknowledgementHandler handler, final Message message) { if (handler != null) { handler.sendAcknowledged(message); } else if (sendAckHandler != null) { sendAckHandler.sendAcknowledged(message); } }
/** * @param interceptorList a comma separated string of incoming interceptor class names to be used. Each interceptor needs a default Constructor to be used with this method. */ public void setOutgoingInterceptorList(String interceptorList) { serverLocator.setOutgoingInterceptorList(interceptorList); }
@Override public long getJMSDeliveryTime() throws JMSException { return message.getScheduledDeliveryTime(); }
public ActiveMQConnectionFactory(final boolean ha, final TransportConfiguration... initialConnectors) { if (ha) { serverLocator = ActiveMQClient.createServerLocatorWithHA(initialConnectors); } else { serverLocator = ActiveMQClient.createServerLocatorWithoutHA(initialConnectors); } serverLocator.disableFinalizeCheck(); }
@Override public void doBeforeReceive() throws ActiveMQException { bodyLength = message.getBodySize(); }
@Override public void run() { handler.sendAcknowledged(message); } });