Source:
public synchronized void subscribe(String topic, FAsyncCallback callback) throws TException { if (isSubscribed()) { throw new TTransportException(TTransportException.ALREADY_OPEN, "jms client already subscribed"); } if (topic == null || "".equals(topic)) { throw new TTransportException("subscribe subject cannot be empty"); } String formattedTopic = getFormattedTopic(topic); try { session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); Destination destination; if (useQueues) { destination = session.createQueue(formattedTopic); } else { destination = session.createTopic(formattedTopic); } consumer = session.createConsumer(destination); consumer.setMessageListener(message -> { LOGGER.debug("received a message on topic '%s'", formattedTopic); byte[] payload; if (message instanceof BytesMessage) { BytesMessage bytesMessage = (BytesMessage) message; try { payload = new byte[(int) bytesMessage.getBodyLength()]; bytesMessage.readBytes(payload); } catch (JMSException e) { LOGGER.error("failed to get bytes from message", e); return; } } else { LOGGER.error("unhandled message type '%s'", message.getClass().getName()); return; } if (payload.length < 4) { LOGGER.warn("discarding invalid message frame, length less than four"); return; } try { callback.onMessage( new TMemoryInputTransport(payload, 4, payload.length - 4) ); } catch (TException e) { LOGGER.error("error executing user provided callback", e); return; } try { message.acknowledge(); } catch (JMSException e) { LOGGER.error("unable to ack message", e); } LOGGER.debug("finished processing message from topic '%s'", formattedTopic); }); } catch (JMSException e) { throw new TException(e); } }

Target:
public synchronized void subscribe(String topic, FAsyncCallback callback) throws TException { if (isSubscribed()) { throw new TTransportException(TTransportException.ALREADY_OPEN, "jms client already subscribed"); } if (topic == null || "".equals(topic)) { throw new TTransportException("subscribe subject cannot be empty"); } String formattedTopic = getFormattedTopic(topic); try { session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); Destination destination; if (useQueues) { destination = session.createQueue(formattedTopic); } else { destination = session.createTopic(formattedTopic); } consumer = session.createConsumer(destination); consumer.setMessageListener(message -> { LOGGER.debug("received a message on topic '{}'", formattedTopic); byte[] payload; if (message instanceof BytesMessage) { BytesMessage bytesMessage = (BytesMessage) message; try { payload = new byte[(int) bytesMessage.getBodyLength()]; bytesMessage.readBytes(payload); } catch (JMSException e) { LOGGER.error("failed to get bytes from message", e); return; } } else { LOGGER.error("unhandled message type '{}'", message.getClass().getName()); return; } if (payload.length < 4) { LOGGER.warn("discarding invalid message frame, length less than four"); return; } try { callback.onMessage( new TMemoryInputTransport(payload, 4, payload.length - 4) ); } catch (Exception e) { LOGGER.error("error executing user provided callback", e); return; } try { message.acknowledge(); } catch (JMSException e) { LOGGER.error("unable to ack message", e); } LOGGER.debug("finished processing message from topic '{}'", formattedTopic); }); } catch (JMSException e) { throw new TException(e); } }