congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
MessageProperties.setExpiration
Code IndexAdd Tabnine to your IDE (free)

How to use
setExpiration
method
in
org.springframework.amqp.core.MessageProperties

Best Java code snippets using org.springframework.amqp.core.MessageProperties.setExpiration (Showing top 20 results out of 315)

origin: macrozheng/mall

  @Override
  public Message postProcessMessage(Message message) throws AmqpException {
    //给消息设置延迟毫秒值
    message.getMessageProperties().setExpiration(String.valueOf(delayTimes));
    return message;
  }
});
origin: vector4wang/spring-boot-quick

@Override
public Message postProcessMessage(Message message) throws AmqpException {
  message.getMessageProperties()
      .setExpiration(ttl.toString()); // 设置per-message的失效时间
  return message;
}
origin: vector4wang/spring-boot-quick

  @Override
  public Message postProcessMessage(Message message) throws AmqpException {
    message.getMessageProperties().setExpiration(msg.getTtl() + "");
    return message;
  }
});
origin: spring-projects/spring-amqp

public MessageBuilderSupport<T> setExpiration(String expiration) {
  this.properties.setExpiration(expiration);
  return this;
}
origin: spring-projects/spring-integration

amqpMessageProperties.setExpiration(expiration);
origin: spring-projects/spring-integration

amqpProperties.setReceivedDeliveryMode(MessageDeliveryMode.NON_PERSISTENT);
amqpProperties.setDeliveryTag(1234L);
amqpProperties.setExpiration("test.expiration");
amqpProperties.setMessageCount(42);
amqpProperties.setMessageId("test.messageId");
origin: spring-projects/spring-amqp

public MessageBuilderSupport<T> setExpirationIfAbsent(String expiration) {
  if (this.properties.getExpiration() == null) {
    this.properties.setExpiration(expiration);
  }
  return this;
}
origin: Lovelcp/blog-demos

  @Override
  public Message postProcessMessage(Message message) throws AmqpException {
    message.getMessageProperties()
        .setExpiration(ttl.toString()); // 设置per-message的失效时间
    return message;
  }
}
origin: Lovelcp/blog-demos

  @Override
  public Message postProcessMessage(Message message) throws AmqpException {
    message.getMessageProperties()
        .setExpiration(ttl.toString()); // 设置per-message的失效时间
    return message;
  }
}
origin: liuweijw/fw-cloud-framework

  @Override
  public Message postProcessMessage(Message message) throws AmqpException {
    message.getMessageProperties().setExpiration(count + "");
    message.getMessageProperties().setDeliveryMode(
        MessageDeliveryMode.PERSISTENT);
    return message;
  }
});
origin: battcn/spring-boot2-learning

  /**
   * this.rabbitTemplate.convertAndSend(RabbitConfig.REGISTER_DELAY_EXCHANGE, RabbitConfig.DELAY_ROUTING_KEY, book); 对应 {@link BookHandler#listenerDelayQueue}
   */
  @GetMapping
  public void defaultMessage() {
    Book book = new Book();
    book.setId("1");
    book.setName("一起来学Spring Boot");
    // 添加延时队列
    this.rabbitTemplate.convertAndSend(RabbitConfig.REGISTER_DELAY_EXCHANGE, RabbitConfig.DELAY_ROUTING_KEY, book, message -> {
      // TODO 第一句是可要可不要,根据自己需要自行处理
      message.getMessageProperties().setHeader(AbstractJavaTypeMapper.DEFAULT_CONTENT_CLASSID_FIELD_NAME, Book.class.getName());
      // TODO 如果配置了 params.put("x-message-ttl", 5 * 1000); 那么这一句也可以省略,具体根据业务需要是声明 Queue 的时候就指定好延迟时间还是在发送自己控制时间
      message.getMessageProperties().setExpiration(5 * 1000 + "");
      return message;
    });
    log.info("[发送时间] - [{}]", LocalDateTime.now());
  }
}
origin: WinterChenS/springboot-learning-experience

/**
 * this.rabbitTemplate.convertAndSend(RabbitConfig.REGISTER_DELAY_EXCHANGE, RabbitConfig.DELAY_ROUTING_KEY, book); 对应 {@link BookHandler#listenerDelayQueue}
 */
@GetMapping
public void defaultMessage() {
  Book book = new Book();
  book.setId("1");
  book.setName("一起来学Spring Boot");
  // 添加延时队列
  this.rabbitTemplate.convertAndSend(RabbitConfig.REGISTER_DELAY_EXCHANGE, RabbitConfig.DELAY_ROUTING_KEY, book, message -> {
    // TODO 第一句是可要可不要,根据自己需要自行处理
    message.getMessageProperties().setHeader(AbstractJavaTypeMapper.DEFAULT_CONTENT_CLASSID_FIELD_NAME, Book.class.getName());
    // TODO 如果配置了 params.put("x-message-ttl", 5 * 1000); 那么这一句也可以省略,具体根据业务需要是声明 Queue 的时候就指定好延迟时间还是在发送自己控制时间
    message.getMessageProperties().setExpiration(5 * 1000 + "");
    return message;
  });
  log.info("[发送时间] - [{}]", LocalDateTime.now());
}
origin: com.bluelock/camel-spring-amqp

  msg.getMessageProperties().setCorrelationId(correlationId);
} else if(EXPIRATION.equals(headerKey)) {
  msg.getMessageProperties().setExpiration(headerValueString);
} else if(PRIORITY.equals(headerKey)) {
  Integer priority = headerValueString != null ? Integer.parseInt(headerValueString) : null;
origin: Bluelock/camel-spring-amqp

  msg.getMessageProperties().setCorrelationId(correlationId);
} else if(EXPIRATION.equals(headerKey)) {
  msg.getMessageProperties().setExpiration(headerValueString);
} else if(PRIORITY.equals(headerKey)) {
  Integer priority = headerValueString != null ? Integer.parseInt(headerValueString) : null;
origin: com.dell.cpsd.common.messaging/common-rabbitmq

  /**
   * {@inheritDoc}
   */
  @Override
  public Message postProcessMessage(final Message message) throws AmqpException
  {
    if (message == null)
    {
      return message;
    }

    final MessageProperties messageProperties = message.getMessageProperties();

    messageProperties.setTimestamp(this.properties.getTimestamp());

    final byte[] correlationId = this.properties.getCorrelationId();
    messageProperties.setCorrelationId(correlationId);

    messageProperties.setCorrelationIdString(this.properties.getCorrelationIdString());

    messageProperties.setReplyTo(this.properties.getReplyTo());
    messageProperties.setExpiration(this.properties.getExpiration());

    return message;
  }
}
origin: com.dell.cpsd/common-rabbitmq

  /**
   * {@inheritDoc}
   */
  @Override
  public Message postProcessMessage(final Message message) throws AmqpException
  {
    if (message == null)
    {
      return message;
    }

    final MessageProperties messageProperties = message.getMessageProperties();

    messageProperties.setTimestamp(this.properties.getTimestamp());

    final byte[] correlationId = this.properties.getCorrelationId();
    messageProperties.setCorrelationId(correlationId);

    messageProperties.setCorrelationIdString(this.properties.getCorrelationIdString());

    messageProperties.setReplyTo(this.properties.getReplyTo());
    messageProperties.setExpiration(this.properties.getExpiration());

    return message;
  }
}
origin: org.springframework.amqp/spring-rabbit

target.setExpiration(source.getExpiration());
target.setPriority(source.getPriority());
target.setContentType(source.getContentType());
origin: spring-projects/spring-amqp

target.setExpiration(source.getExpiration());
target.setPriority(source.getPriority());
target.setContentType(source.getContentType());
origin: spring-projects/spring-amqp

amqpProperties.setReceivedDeliveryMode(MessageDeliveryMode.NON_PERSISTENT);
amqpProperties.setDeliveryTag(1234L);
amqpProperties.setExpiration("test.expiration");
amqpProperties.setMessageCount(42);
amqpProperties.setMessageId("test.messageId");
origin: spring-projects/spring-amqp

properties.setReceivedDeliveryMode(MessageDeliveryMode.NON_PERSISTENT);
properties.setDeliveryTag(555L);
properties.setExpiration("expiration-1234");
properties.setMessageCount(42);
properties.setMessageId("message-id-1234");
org.springframework.amqp.coreMessagePropertiessetExpiration

Popular methods of MessageProperties

  • getDeliveryTag
  • <init>
  • setHeader
  • getHeaders
  • setContentType
  • getReplyTo
  • getCorrelationId
  • getMessageId
  • getReceivedRoutingKey
  • setCorrelationId
  • setDeliveryMode
  • setReplyTo
  • setDeliveryMode,
  • setReplyTo,
  • getConsumerQueue,
  • getReceivedExchange,
  • getContentType,
  • getExpiration,
  • setContentEncoding,
  • setMessageId,
  • getAppId

Popular in Java

  • Start an intent from android
  • notifyDataSetChanged (ArrayAdapter)
  • addToBackStack (FragmentTransaction)
  • onCreateOptionsMenu (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now