use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class GeneralInteropTest method sendStreamMessageUsingOpenWire.
private void sendStreamMessageUsingOpenWire(String queueName) throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
System.out.println("destination: " + destination);
final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
StreamMessage streamMessage = session.createStreamMessage();
streamMessage.writeBoolean(true);
streamMessage.writeByte((byte) 2);
streamMessage.writeBytes(new byte[] { 6, 7 });
streamMessage.writeChar('b');
streamMessage.writeDouble(6.5);
streamMessage.writeFloat((float) 93.9);
streamMessage.writeInt(7657);
streamMessage.writeLong(239999L);
streamMessage.writeShort((short) 34222);
streamMessage.writeString("hello streammessage");
producer.send(streamMessage);
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class GeneralInteropTest method sendTextMessageUsingOpenWire.
private void sendTextMessageUsingOpenWire(String text) throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
TextMessage textMessage = session.createTextMessage(text);
producer.send(textMessage);
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class CompressedInteropTest method sendCompressedStreamMessageUsingOpenWire.
private void sendCompressedStreamMessageUsingOpenWire() throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
StreamMessage streamMessage = session.createStreamMessage();
streamMessage.writeBoolean(true);
streamMessage.writeByte((byte) 10);
streamMessage.writeBytes(TEXT.getBytes());
streamMessage.writeChar('A');
streamMessage.writeDouble(55.3D);
streamMessage.writeFloat(79.1F);
streamMessage.writeInt(37);
streamMessage.writeLong(56652L);
streamMessage.writeObject(new String("VVVV"));
streamMessage.writeShort((short) 333);
streamMessage.writeString(TEXT);
producer.send(streamMessage);
}
use of org.apache.activemq.command.ActiveMQDestination in project activemq-artemis by apache.
the class CompressedInteropTest method sendCompressedBytesMessageUsingOpenWire.
private void sendCompressedBytesMessageUsingOpenWire() throws Exception {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
ActiveMQDestination destination = createDestination(session, ActiveMQDestination.QUEUE_TYPE);
final ActiveMQMessageProducer producer = (ActiveMQMessageProducer) session.createProducer(destination);
BytesMessage bytesMessage = session.createBytesMessage();
bytesMessage.writeBytes(TEXT.getBytes());
producer.send(bytesMessage);
}
use of org.apache.activemq.command.ActiveMQDestination in project pinpoint by naver.
the class ActiveMQMessageConsumerDispatchInterceptor method doInBeforeTrace.
@Override
protected void doInBeforeTrace(SpanRecorder recorder, Object target, Object[] args) {
recorder.recordServiceType(ActiveMQClientConstants.ACTIVEMQ_CLIENT);
ActiveMQSession session = ((ActiveMQSessionGetter) target)._$PINPOINT$_getActiveMQSession();
ActiveMQConnection connection = session.getConnection();
Transport transport = getRootTransport(((TransportGetter) connection)._$PINPOINT$_getTransport());
Socket socket = ((SocketGetter) transport)._$PINPOINT$_getSocket();
SocketAddress localSocketAddress = socket.getLocalSocketAddress();
String endPoint = ActiveMQClientUtils.getEndPoint(localSocketAddress);
// Endpoint should be the local socket address of the consumer.
recorder.recordEndPoint(endPoint);
SocketAddress remoteSocketAddress = socket.getRemoteSocketAddress();
String remoteAddress = ActiveMQClientUtils.getEndPoint(remoteSocketAddress);
// Remote address is the socket address of where the consumer is connected to.
recorder.recordRemoteAddress(remoteAddress);
MessageDispatch md = (MessageDispatch) args[0];
ActiveMQMessage message = (ActiveMQMessage) md.getMessage();
ActiveMQDestination destination = message.getDestination();
// Rpc name is the URI of the queue/topic we're consuming from.
recorder.recordRpcName(destination.getQualifiedName());
// Record acceptor host as the queue/topic name in order to generate virtual queue node.
recorder.recordAcceptorHost(destination.getPhysicalName());
String parentApplicationName = ActiveMQClientHeader.getParentApplicationName(message, null);
if (!recorder.isRoot() && parentApplicationName != null) {
short parentApplicationType = ActiveMQClientHeader.getParentApplicationType(message, ServiceType.UNDEFINED.getCode());
recorder.recordParentApplication(parentApplicationName, parentApplicationType);
}
}
Aggregations