/** * Closes the ClientRequestor and its session. * * @throws Exception if an exception occurs while closing the ClientRequestor */ public void close() throws Exception { replyConsumer.close(); requestProducer.close(); queueSession.deleteQueue(replyQueue); }
/** * Closes the ClientRequestor and its session. * * @throws Exception if an exception occurs while closing the ClientRequestor */ public void close() throws Exception { replyConsumer.close(); queueSession.deleteQueue(replyQueue); queueSession.close(); }
public HornetQConnectionFactory(final boolean ha, final TransportConfiguration... initialConnectors) { if (ha) { serverLocator = HornetQClient.createServerLocatorWithHA(initialConnectors); } else { serverLocator = HornetQClient.createServerLocatorWithoutHA(initialConnectors); } serverLocator.disableFinalizeCheck(); }
static boolean queueExists(final String queueName, final ClientSessionFactory sf) throws HornetQException { final ClientSession session = sf.createSession(false, false, false); try { final QueueQuery query = session.queueQuery(new SimpleString(queueName)); return query.isExists(); } finally { session.close(); } }
/** * 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</code> 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); }
/** * Closes the passed-in {@link ServerLocator}. * * @param serverLocator the {@link ServerLocator} instance to close. */ public static void closeServerLocator(final ServerLocator serverLocator) { if (serverLocator != null) { serverLocator.close(); } }
@Override public void doBeforeReceive() throws Exception { bodyLength = message.getBodySize(); }
public void setJMSExpiration(final long expiration) throws JMSException { message.setExpiration(expiration); }
public synchronized String getConnectionLoadBalancingPolicyClassName() { return serverLocator.getConnectionLoadBalancingPolicyClassName(); }
public synchronized long getClientFailureCheckPeriod() { return serverLocator.getClientFailureCheckPeriod(); }
public synchronized int getProducerMaxRate() { return serverLocator.getProducerMaxRate(); }
public synchronized boolean isBlockOnNonDurableSend() { return serverLocator.isBlockOnNonDurableSend(); }
public synchronized int getThreadPoolMaxSize() { return serverLocator.getThreadPoolMaxSize(); }
public String getGroupID() { return serverLocator.getGroupID(); }
public XAResource getXAResource() { return session.getXAResource(); }
public void setJMSTimestamp(final long timestamp) throws JMSException { message.setTimestamp(timestamp); }
public HornetQConnectionFactory(final ServerLocator serverLocator) { this.serverLocator = serverLocator; serverLocator.disableFinalizeCheck(); }
public byte[] getJMSCorrelationIDAsBytes() throws JMSException { Object obj = message.getObjectProperty(HornetQMessage.CORRELATIONID_HEADER_NAME); if (obj instanceof byte[]) { return (byte[])obj; } else { return null; } }
/** * 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); }
public HornetQConnectionFactory(final boolean ha, final DiscoveryGroupConfiguration groupConfiguration) { if (ha) { serverLocator = HornetQClient.createServerLocatorWithHA(groupConfiguration); } else { serverLocator = HornetQClient.createServerLocatorWithoutHA(groupConfiguration); } serverLocator.disableFinalizeCheck(); }