org.apache.activemq.artemis.api.core.Message.setAddress()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(281)

本文整理了Java中org.apache.activemq.artemis.api.core.Message.setAddress()方法的一些代码示例,展示了Message.setAddress()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setAddress()方法的具体详情如下:
包路径:org.apache.activemq.artemis.api.core.Message
类名称:Message
方法名:setAddress

Message.setAddress介绍

[英]Look at #setAddress(SimpleString) for the doc.
[中]查看#setAddress(SimpleString)获取文档。

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
public void setAddress(final Message message, final SimpleString address) {
 logger.tracef("setAddress() Setting default address as %s", address);
 message.setAddress(address);
}

代码示例来源:origin: wildfly/wildfly

@Override
  public Message decode(ActiveMQBuffer buffer, Message record) {
   // the caller must consume the first byte already, as that will be used to decide what persister (protocol) to use
   long id = buffer.readLong();
   SimpleString address = buffer.readNullableSimpleString();
   record = new CoreMessage();
   record.reloadPersistence(buffer);
   record.setMessageID(id);
   record.setAddress(address);
   return record;
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public void setAddress(final Message message, final SimpleString address) {
 logger.tracef("setAddress() Setting default address as %s", address);
 message.setAddress(address);
}

代码示例来源:origin: apache/activemq-artemis

@Override
public void setAddress(final Message message, final SimpleString address) {
 logger.tracef("setAddress() Setting default address as %s", address);
 message.setAddress(address);
}

代码示例来源:origin: apache/activemq-artemis

@Override
public void setAddress(final Message message, final SimpleString address) {
 logger.tracef("setAddress() Setting default address as %s", address);
 message.setAddress(address);
}

代码示例来源:origin: apache/activemq-artemis

@Override
public void setAddress(final Message message, final SimpleString address) {
 logger.tracef("setAddress() Setting default address as %s", address);
 message.setAddress(address);
}

代码示例来源:origin: org.apache.activemq/artemis-core-client

@Override
public void setAddress(final Message message, final SimpleString address) {
 logger.tracef("setAddress() Setting default address as %s", address);
 message.setAddress(address);
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
public void setAddress(final Message message, final SimpleString address) {
 logger.tracef("setAddress() Setting default address as %s", address);
 message.setAddress(address);
}

代码示例来源:origin: apache/activemq-artemis

private void move(final SimpleString toAddress,
         final Transaction tx,
         final MessageReference ref,
         final boolean expiry,
         final boolean rejectDuplicate,
         final long... queueIDs) throws Exception {
 Message copyMessage = makeCopy(ref, expiry);
 copyMessage.setAddress(toAddress);
 if (queueIDs != null && queueIDs.length > 0) {
   ByteBuffer buffer = ByteBuffer.allocate(8 * queueIDs.length);
   for (long id : queueIDs) {
    buffer.putLong(id);
   }
   copyMessage.putBytesProperty(Message.HDR_ROUTE_TO_IDS.toString(), buffer.array());
 }
 postOffice.route(copyMessage, tx, false, rejectDuplicate);
 if (expiry) {
   acknowledge(tx, ref, AckReason.EXPIRED, null);
 } else {
   acknowledge(tx, ref);
 }
}

代码示例来源:origin: apache/activemq-artemis

@Override
  public Message decode(ActiveMQBuffer buffer, Message record) {
   // the caller must consume the first byte already, as that will be used to decide what persister (protocol) to use
   long id = buffer.readLong();
   SimpleString address = buffer.readNullableSimpleString();
   record = new CoreMessage();
   record.reloadPersistence(buffer);
   record.setMessageID(id);
   record.setAddress(address);
   return record;
  }
}

代码示例来源:origin: apache/activemq-artemis

@Override
  public Message decode(ActiveMQBuffer buffer, Message record) {
   // the caller must consume the first byte already, as that will be used to decide what persister (protocol) to use
   long id = buffer.readLong();
   SimpleString address = buffer.readNullableSimpleString();
   record = new CoreMessage();
   record.reloadPersistence(buffer);
   record.setMessageID(id);
   record.setAddress(address);
   return record;
  }
}

代码示例来源:origin: org.apache.activemq/artemis-core-client

@Override
  public Message decode(ActiveMQBuffer buffer, Message record) {
   // the caller must consume the first byte already, as that will be used to decide what persister (protocol) to use
   long id = buffer.readLong();
   SimpleString address = buffer.readNullableSimpleString();
   record = new CoreMessage();
   record.reloadPersistence(buffer);
   record.setMessageID(id);
   record.setAddress(address);
   return record;
  }
}

代码示例来源:origin: apache/activemq-artemis

@Override
  public Message decode(ActiveMQBuffer buffer, Message record) {
   // the caller must consume the first byte already, as that will be used to decide what persister (protocol) to use
   long id = buffer.readLong();
   SimpleString address = buffer.readNullableSimpleString();
   record = new CoreMessage();
   record.reloadPersistence(buffer);
   record.setMessageID(id);
   record.setAddress(address);
   return record;
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
  public Message decode(ActiveMQBuffer buffer, Message record) {
   // the caller must consume the first byte already, as that will be used to decide what persister (protocol) to use
   long id = buffer.readLong();
   SimpleString address = buffer.readNullableSimpleString();
   record = new CoreMessage();
   record.reloadPersistence(buffer);
   record.setMessageID(id);
   record.setAddress(address);
   return record;
  }
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
  public Message decode(ActiveMQBuffer buffer, Message record) {
   // the caller must consume the first byte already, as that will be used to decide what persister (protocol) to use
   long id = buffer.readLong();
   SimpleString address = buffer.readNullableSimpleString();
   record = new CoreMessage();
   record.reloadPersistence(buffer);
   record.setMessageID(id);
   record.setAddress(address);
   return record;
  }
}

代码示例来源:origin: apache/activemq-artemis

@Override
  public Message decode(ActiveMQBuffer buffer, Message record) {
   long id = buffer.readLong();
   long format = buffer.readLong();
   SimpleString address = buffer.readNullableSimpleString();
   record = new AMQPMessage(format);
   record.reloadPersistence(buffer);
   record.setMessageID(id);
   if (address != null) {
     record.setAddress(address);
   }
   return record;
  }
}

代码示例来源:origin: org.apache.activemq/artemis-amqp-protocol

@Override
public Message decode(ActiveMQBuffer buffer, Message record) {
 long id = buffer.readLong();
 long format = buffer.readLong();
 SimpleString address = buffer.readNullableSimpleString();
 record = new AMQPMessage(format);
 record.reloadPersistence(buffer);
 record.setMessageID(id);
 if (address != null) {
   record.setAddress(address);
 }
 return record;
}

代码示例来源:origin: apache/activemq-artemis

private Message createQueueInfoMessage(final NotificationType type, final SimpleString queueName) {
 Message message = new CoreMessage().initBuffer(50).setMessageID(storageManager.generateID());
 message.setAddress(queueName);
 String uid = UUIDGenerator.getInstance().generateStringUUID();
 message.putStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE, new SimpleString(type.toString()));
 message.putLongProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP, System.currentTimeMillis());
 message.putStringProperty(new SimpleString("foobar"), new SimpleString(uid));
 return message;
}

代码示例来源:origin: apache/activemq-artemis

/**
* Prompt delivery and send a "forced delivery" message to the consumer.
* <p>
* When the consumer receives such a "forced delivery" message, it discards it and knows that
* there are no other messages to be delivered.
*/
@Override
public void forceDelivery(final long sequence)  {
 forceDelivery(sequence, () -> {
   Message forcedDeliveryMessage = new CoreMessage(storageManager.generateID(), 50);
   MessageReference reference = MessageReference.Factory.createReference(forcedDeliveryMessage, messageQueue);
   reference.setDeliveryCount(0);
   forcedDeliveryMessage.putLongProperty(ClientConsumerImpl.FORCED_DELIVERY_MESSAGE, sequence);
   forcedDeliveryMessage.setAddress(messageQueue.getName());
   applyPrefixForLegacyConsumer(forcedDeliveryMessage);
   callback.sendMessage(reference, forcedDeliveryMessage, ServerConsumerImpl.this, 0);
 });
}

代码示例来源:origin: apache/activemq-artemis

@Test
public void testAMQSize() throws Exception {
 message.setAddress(RandomUtil.randomSimpleString());
 int encodeSize = message.getEncodeSize();
 Filter moreThanSmall = FilterImpl.createFilter(new SimpleString("AMQSize > " + (encodeSize - 1)));
 Filter lessThanLarge = FilterImpl.createFilter(new SimpleString("AMQSize < " + (encodeSize + 1)));
 Filter lessThanSmall = FilterImpl.createFilter(new SimpleString("AMQSize < " + encodeSize));
 Filter moreThanLarge = FilterImpl.createFilter(new SimpleString("AMQSize > " + encodeSize));
 Assert.assertTrue(moreThanSmall.match(message));
 Assert.assertTrue(lessThanLarge.match(message));
 Assert.assertFalse(lessThanSmall.match(message));
 Assert.assertFalse(moreThanLarge.match(message));
}

相关文章