Este conteúdo não está disponível no idioma selecionado.

Chapter 13. Scheduling Messages


You can specify a time in the future, at the earliest, for a message to be delivered. This can be done by setting the _AMQ_SCHED_DELIVERY scheduled delivery property before the message is sent.

The specified value must be a positive long that corresponds to the time in milliseconds for the message to be delivered. Below is an example of sending a scheduled message using the JMS API.

// Create a message to be delivered in 5 seconds
TextMessage message = session.createTextMessage("This is a scheduled message message that will be delivered in 5 sec.");
message.setLongProperty("_AMQ_SCHED_DELIVERY", System.currentTimeMillis() + 5000);
producer.send(message);

...

// The message will not be received immediately, but 5 seconds later
TextMessage messageReceived = (TextMessage) consumer.receive();
Copy to Clipboard Toggle word wrap

Scheduled messages can also be sent using the core API by setting the _AMQ_SCHED_DELIVERY property before sending the message.

Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat