org.apache.activemq.command.Message.isPersistent()方法的使用及代码示例

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

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

Message.isPersistent介绍

暂无

代码示例

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

@Override
public boolean isSendToDeadLetterQueue(Message message) {
  boolean result = false;
  if (message != null) {
    result = true;
    if (enableAudit && messageAudit.isDuplicate(message)) {
      result = false;
      LOG.debug("Not adding duplicate to DLQ: {}, dest: {}", message.getMessageId(), message.getDestination());
    }
    if (!message.isPersistent() && !processNonPersistent) {
      result = false;
    }
    if (message.isExpired() && !processExpired) {
      result = false;
    }
  }
  return result;
}

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

private LocalTransactionId beginLocalTransaction(int numDestinations, ConnectionContext connectionContext, Message message) throws Exception {
  LocalTransactionId result = null;
  if (transactedSend && numDestinations > 1 && message.isPersistent() && message.getTransactionId() == null) {
    result = new LocalTransactionId(new ConnectionId(message.getMessageId().getProducerId().toString()), message.getMessageId().getProducerSequenceId());
    connectionContext.getBroker().beginTransaction(connectionContext, result);
    connectionContext.setTransaction(connectionContext.getTransactions().get(result));
    message.setTransactionId(result);
  }
  return result;
}

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

looseMarshalCachedObject(wireFormat, (DataStructure)info.getProducerId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getTransactionId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getOriginalDestination(), dataOut);
looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessageId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getOriginalTransactionId(), dataOut);
looseMarshalString(info.getGroupID(), dataOut);
dataOut.writeInt(info.getGroupSequence());
looseMarshalString(info.getCorrelationId(), dataOut);
dataOut.writeBoolean(info.isPersistent());
looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
dataOut.writeByte(info.getPriority());
looseMarshalNestedObject(wireFormat, (DataStructure)info.getReplyTo(), dataOut);
looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
looseMarshalString(info.getType(), dataOut);
looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
dataOut.writeBoolean(info.isCompressed());
dataOut.writeInt(info.getRedeliveryCounter());
looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
looseMarshalLong(wireFormat, info.getArrival(), dataOut);
looseMarshalString(info.getUserID(), dataOut);

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

if (!msg.isPersistent()) {
  if (isSendAdvisoryIfNoConsumers()) {
      if (message.getOriginalDestination() != null) {
        message.setOriginalDestination(message.getDestination());
      if (message.getOriginalTransactionId() != null) {
        message.setOriginalTransactionId(message.getTransactionId());

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

configuration.getBrokerName(), remoteBrokerName, Arrays.toString(md.getMessage().getBrokerPath()), md.getMessage()
  });
    configuration.getBrokerName(), remoteBrokerName, md.getConsumerId(), message.getDestination(), Arrays.toString(message.getBrokerPath()), (LOG.isTraceEnabled() ? message : message.getMessageId())
});
if (isDuplex() && NetworkBridgeFilter.isAdvisoryInterpretedByNetworkBridge(message)) {
  if (message.isPersistent() || configuration.isAlwaysSyncSend()) {

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

final String type = messageSend.getType();
if (type != null) {
  coreMessage.putStringProperty(JMS_TYPE_PROPERTY, new SimpleString(type));
coreMessage.setDurable(messageSend.isPersistent());
coreMessage.setExpiration(messageSend.getExpiration());
coreMessage.setPriority(messageSend.getPriority());
final BrokerId[] brokers = messageSend.getBrokerPath();
if (brokers != null) {
  putMsgBrokerPath(brokers, coreMessage);
final MessageId messageId = messageSend.getMessageId();
coreMessage.putBytesProperty(AMQ_MSG_MESSAGE_ID, midBytes.data);
final ProducerId producerId = messageSend.getProducerId();
if (producerId != null) {
  final ByteSequence producerIdBytes = marshaller.marshal(producerId);
final ActiveMQDestination origDest = messageSend.getOriginalDestination();
if (origDest != null) {
  putMsgOriginalDestination(origDest, marshaller, coreMessage);

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

throws IOException, Exception {
final ConnectionContext context = producerExchange.getConnectionContext();
message.getMessageId().setBrokerSequenceId(getDestinationSequenceId());
Future<Object> result = null;
if (topicStore != null && message.isPersistent() && !canOptimizeOutPersistence()) {
  if (systemUsage.getStoreUsage().isFull(getStoreUsageHighWaterMark())) {
    final String logMessage = "Persistent store is Full, " + getStoreUsageHighWaterMark() + "% of "
        + systemUsage.getStoreUsage().getLimit() + ". Stopping producer (" + message.getProducerId()
        + ") to prevent flooding " + getActiveMQDestination().getQualifiedName() + "."
        + " See http://activemq.apache.org/producer-flow-control.html for more info";

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

looseMarshalCachedObject(wireFormat, (DataStructure)info.getProducerId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getTransactionId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getOriginalDestination(), dataOut);
looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessageId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getOriginalTransactionId(), dataOut);
looseMarshalString(info.getGroupID(), dataOut);
dataOut.writeInt(info.getGroupSequence());
looseMarshalString(info.getCorrelationId(), dataOut);
dataOut.writeBoolean(info.isPersistent());
looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
dataOut.writeByte(info.getPriority());
looseMarshalNestedObject(wireFormat, (DataStructure)info.getReplyTo(), dataOut);
looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
looseMarshalString(info.getType(), dataOut);
looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
dataOut.writeBoolean(info.isCompressed());
dataOut.writeInt(info.getRedeliveryCounter());
looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
looseMarshalLong(wireFormat, info.getArrival(), dataOut);
looseMarshalString(info.getUserID(), dataOut);

代码示例来源:origin: org.apache.activemq/activemq-broker

if (!msg.isPersistent()) {
  if (isSendAdvisoryIfNoConsumers()) {
      if (message.getOriginalDestination() != null) {
        message.setOriginalDestination(message.getDestination());
      if (message.getOriginalTransactionId() != null) {
        message.setOriginalTransactionId(message.getTransactionId());

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

ActiveMQDestination deadLetterDestination = deadLetterStrategy.getDeadLetterQueueFor(message, subscription);
  if (deadLetterDestination.equals(message.getDestination())) {
    LOG.debug("Not re-adding to DLQ: {}, dest: {}", message.getMessageId(), message.getDestination());
    return false;
  if (!message.isPersistent()) {
    message.setPersistent(true);
    message.setProperty("originalDeliveryMode", "NON_PERSISTENT");
LOG.debug("Dead Letter message with no DLQ strategy in place, message id: {}, destination: {}", message.getMessageId(), message.getDestination());

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

configuration.getBrokerName(), remoteBrokerName, Arrays.toString(md.getMessage().getBrokerPath()), md.getMessage()
  });
    configuration.getBrokerName(), remoteBrokerName, md.getConsumerId(), message.getDestination(), Arrays.toString(message.getBrokerPath()), (LOG.isTraceEnabled() ? message : message.getMessageId())
});
if (isDuplex() && NetworkBridgeFilter.isAdvisoryInterpretedByNetworkBridge(message)) {
  if (message.isPersistent() || configuration.isAlwaysSyncSend()) {

代码示例来源:origin: org.apache.activemq/activemq-broker

throws IOException, Exception {
final ConnectionContext context = producerExchange.getConnectionContext();
message.getMessageId().setBrokerSequenceId(getDestinationSequenceId());
Future<Object> result = null;
if (topicStore != null && message.isPersistent() && !canOptimizeOutPersistence()) {
  if (systemUsage.getStoreUsage().isFull(getStoreUsageHighWaterMark())) {
    final String logMessage = "Persistent store is Full, " + getStoreUsageHighWaterMark() + "% of "
        + systemUsage.getStoreUsage().getLimit() + ". Stopping producer (" + message.getProducerId()
        + ") to prevent flooding " + getActiveMQDestination().getQualifiedName() + "."
        + " See http://activemq.apache.org/producer-flow-control.html for more info";

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

private LocalTransactionId beginLocalTransaction(int numDestinations, ConnectionContext connectionContext, Message message) throws Exception {
  LocalTransactionId result = null;
  if (transactedSend && numDestinations > 1 && message.isPersistent() && message.getTransactionId() == null) {
    result = new LocalTransactionId(new ConnectionId(message.getMessageId().getProducerId().toString()), message.getMessageId().getProducerSequenceId());
    connectionContext.getBroker().beginTransaction(connectionContext, result);
    connectionContext.setTransaction(connectionContext.getTransactions().get(result));
    message.setTransactionId(result);
  }
  return result;
}

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

looseMarshalCachedObject(wireFormat, (DataStructure)info.getProducerId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getTransactionId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getOriginalDestination(), dataOut);
looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessageId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getOriginalTransactionId(), dataOut);
looseMarshalString(info.getGroupID(), dataOut);
dataOut.writeInt(info.getGroupSequence());
looseMarshalString(info.getCorrelationId(), dataOut);
dataOut.writeBoolean(info.isPersistent());
looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
dataOut.writeByte(info.getPriority());
looseMarshalNestedObject(wireFormat, (DataStructure)info.getReplyTo(), dataOut);
looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
looseMarshalString(info.getType(), dataOut);
looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
dataOut.writeBoolean(info.isCompressed());
dataOut.writeInt(info.getRedeliveryCounter());
looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
looseMarshalLong(wireFormat, info.getArrival(), dataOut);
looseMarshalString(info.getUserID(), dataOut);

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

if (!msg.isPersistent()) {
  if (isSendAdvisoryIfNoConsumers()) {
      if (message.getOriginalDestination() != null) {
        message.setOriginalDestination(message.getDestination());
      if (message.getOriginalTransactionId() != null) {
        message.setOriginalTransactionId(message.getTransactionId());

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

message.incrementRedeliveryCounter();
try {
  if (message.isPersistent()) {
    ((BaseDestination) message.getRegionDestination()).getMessageStore().updateMessage(message);
  RuntimeException runtimeException = new RuntimeException("Failed to persist JMSRedeliveryFlag on " + message.getMessageId() + " in " + message.getDestination(), error);
  LOG.warn(runtimeException.getLocalizedMessage(), runtimeException);
  throw runtimeException;

代码示例来源:origin: org.apache.activemq/activemq-broker

configuration.getBrokerName(), remoteBrokerName, Arrays.toString(md.getMessage().getBrokerPath()), md.getMessage()
  });
    configuration.getBrokerName(), remoteBrokerName, md.getConsumerId(), message.getDestination(), Arrays.toString(message.getBrokerPath()), (LOG.isTraceEnabled() ? message : message.getMessageId())
});
if (isDuplex() && NetworkBridgeFilter.isAdvisoryInterpretedByNetworkBridge(message)) {
  if (message.isPersistent() || configuration.isAlwaysSyncSend()) {

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

throws IOException, Exception {
final ConnectionContext context = producerExchange.getConnectionContext();
message.getMessageId().setBrokerSequenceId(getDestinationSequenceId());
Future<Object> result = null;
if (topicStore != null && message.isPersistent() && !canOptimizeOutPersistence()) {
  if (systemUsage.getStoreUsage().isFull(getStoreUsageHighWaterMark())) {
    final String logMessage = "Persistent store is Full, " + getStoreUsageHighWaterMark() + "% of "
        + systemUsage.getStoreUsage().getLimit() + ". Stopping producer (" + message.getProducerId()
        + ") to prevent flooding " + getActiveMQDestination().getQualifiedName() + "."
        + " See http://activemq.apache.org/producer-flow-control.html for more info";

代码示例来源:origin: org.apache.activemq/activemq-osgi

private LocalTransactionId beginLocalTransaction(int numDestinations, ConnectionContext connectionContext, Message message) throws Exception {
  LocalTransactionId result = null;
  if (transactedSend && numDestinations > 1 && message.isPersistent() && message.getTransactionId() == null) {
    result = new LocalTransactionId(new ConnectionId(message.getMessageId().getProducerId().toString()), message.getMessageId().getProducerSequenceId());
    connectionContext.getBroker().beginTransaction(connectionContext, result);
    connectionContext.setTransaction(connectionContext.getTransactions().get(result));
    message.setTransactionId(result);
  }
  return result;
}

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

looseMarshalCachedObject(wireFormat, (DataStructure)info.getProducerId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getTransactionId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getOriginalDestination(), dataOut);
looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessageId(), dataOut);
looseMarshalCachedObject(wireFormat, (DataStructure)info.getOriginalTransactionId(), dataOut);
looseMarshalString(info.getGroupID(), dataOut);
dataOut.writeInt(info.getGroupSequence());
looseMarshalString(info.getCorrelationId(), dataOut);
dataOut.writeBoolean(info.isPersistent());
looseMarshalLong(wireFormat, info.getExpiration(), dataOut);
dataOut.writeByte(info.getPriority());
looseMarshalNestedObject(wireFormat, (DataStructure)info.getReplyTo(), dataOut);
looseMarshalLong(wireFormat, info.getTimestamp(), dataOut);
looseMarshalString(info.getType(), dataOut);
looseMarshalByteSequence(wireFormat, info.getContent(), dataOut);
looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut);
dataOut.writeBoolean(info.isCompressed());
dataOut.writeInt(info.getRedeliveryCounter());
looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
looseMarshalLong(wireFormat, info.getArrival(), dataOut);
looseMarshalString(info.getUserID(), dataOut);

相关文章

Message类方法