Java Code Examples for org.apache.qpid.proton.message.impl.MessageImpl#setUserId()
The following examples show how to use
org.apache.qpid.proton.message.impl.MessageImpl#setUserId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AMQPMessageTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void testGetUserIDFromMessage() { final String USER_NAME = "foo"; MessageImpl protonMessage = (MessageImpl) Message.Factory.create(); protonMessage.setUserId(USER_NAME.getBytes(StandardCharsets.UTF_8)); AMQPStandardMessage decoded = encodeAndDecodeMessage(protonMessage); assertEquals(USER_NAME, decoded.getAMQPUserID()); }
Example 2
Source File: MessageTransformationTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Test public void testComplexQpidJMSMessageEncodeDecode() throws Exception { Map<String, Object> applicationProperties = new HashMap<>(); Map<Symbol, Object> messageAnnotations = new HashMap<>(); applicationProperties.put("property-1", "string-1"); applicationProperties.put("property-2", 512); applicationProperties.put("property-3", true); applicationProperties.put("property-4", "string-2"); applicationProperties.put("property-5", 512); applicationProperties.put("property-6", true); applicationProperties.put("property-7", "string-3"); applicationProperties.put("property-8", 512); applicationProperties.put("property-9", true); messageAnnotations.put(Symbol.valueOf("x-opt-jms-msg-type"), 0); messageAnnotations.put(Symbol.valueOf("x-opt-jms-dest"), 0); messageAnnotations.put(Symbol.valueOf("x-opt-jms-reply-to"), 0); messageAnnotations.put(Symbol.valueOf("x-opt-delivery-delay"), 2000); MessageImpl message = (MessageImpl) Proton.message(); // Header Values message.setPriority((short) 9); message.setDurable(true); message.setDeliveryCount(2); message.setTtl(5000); // Properties message.setMessageId("ID:SomeQualifier:0:0:1"); message.setGroupId("Group-ID-1"); message.setGroupSequence(15); message.setAddress("queue://test-queue"); message.setReplyTo("queue://reply-queue"); message.setCreationTime(System.currentTimeMillis()); message.setContentType("text/plain"); message.setCorrelationId("ID:SomeQualifier:0:7:9"); message.setUserId("username".getBytes(StandardCharsets.UTF_8)); // Application Properties / Message Annotations / Body message.setApplicationProperties(new ApplicationProperties(applicationProperties)); message.setMessageAnnotations(new MessageAnnotations(messageAnnotations)); message.setBody(new AmqpValue("String payload for AMQP message conversion performance testing.")); ICoreMessage core = encodeAndCreateAMQPMessage(message).toCore(); AMQPMessage outboudMessage = AMQPConverter.getInstance().fromCore(core, null); assertEquals(10, outboudMessage.getApplicationProperties().getValue().size()); assertEquals(4, outboudMessage.getMessageAnnotations().getValue().size()); }
Example 3
Source File: JMSTransformationSpeedComparisonTest.java From activemq-artemis with Apache License 2.0 | 4 votes |
private MessageImpl createComplexQpidJMSMessage() { Map<String, Object> applicationProperties = new HashMap<>(); Map<Symbol, Object> messageAnnotations = new HashMap<>(); applicationProperties.put("property-1", "string-1"); applicationProperties.put("property-2", 512); applicationProperties.put("property-3", true); applicationProperties.put("property-4", "string-2"); applicationProperties.put("property-5", 512); applicationProperties.put("property-6", true); applicationProperties.put("property-7", "string-3"); applicationProperties.put("property-8", 512); applicationProperties.put("property-9", true); messageAnnotations.put(Symbol.valueOf("x-opt-jms-msg-type"), 0); messageAnnotations.put(Symbol.valueOf("x-opt-jms-dest"), 0); MessageImpl message = (MessageImpl) Proton.message(); // Header Values message.setPriority((short) 9); message.setDurable(true); message.setDeliveryCount(2); message.setTtl(5000); // Properties message.setMessageId("ID:SomeQualifier:0:0:1"); message.setGroupId("Group-ID-1"); message.setGroupSequence(15); message.setAddress("queue://test-queue"); message.setReplyTo("queue://reply-queue"); message.setCreationTime(System.currentTimeMillis()); message.setContentType("text/plain"); message.setCorrelationId("ID:SomeQualifier:0:7:9"); message.setUserId("username".getBytes(StandardCharsets.UTF_8)); // Application Properties / Message Annotations / Body message.setApplicationProperties(new ApplicationProperties(applicationProperties)); message.setMessageAnnotations(new MessageAnnotations(messageAnnotations)); message.setBody(new AmqpValue("String payload for AMQP message conversion performance testing.")); return message; }