Skip to content

Instantly share code, notes, and snippets.

@danilobatistaqueiroz
Last active May 23, 2019 18:15
Show Gist options
  • Select an option

  • Save danilobatistaqueiroz/423aef552c08bd7129509115abe55e1f to your computer and use it in GitHub Desktop.

Select an option

Save danilobatistaqueiroz/423aef552c08bd7129509115abe55e1f to your computer and use it in GitHub Desktop.
JMS resume
** Using Message-Oriented Middleware, messages are transmitted from one application to
another across a network. MOM products ensure that messages are properly distributed
among applications. In addition, MOMs usually provide fault tolerance, load balancing,
scalability, and transactional support for enterprises that need to reliably exchange large
quantities of messages. **
::Centralized Architectures
::Decentralized Architectures
::JMS Messaging Models: Publish-and-Subscribe and Point-to-Point
Through asynchronous processing, store-and-forward, and guaranteed delivery, it provides high
availability capabilities to keep business applications in continuous operation with
uninterrupted service.
ConnectionFactory and Destination objects are the only things in
JMS that cannot be obtained using the JMS API
unlike connections, sessions, producers,
consumers, and messages, which are manufactured using the JMS API
ConnectionFactory and Destination objects, are also called JMS administered objects because
they are established and configured by a system administrator.
A topic is analogous to a news group or list server: when a message
is sent to a news group or list server, it is delivered to all the subscribers.
A message basically has two parts: a header and payload.
The other message types have special payloads that determine their type and use:
Message
This type has no payload. It is useful for simple event notification.
.Automatically Assigned Headers.
There are two types of delivery modes in JMS: persistent and nonpersistent.
A Message object's expiration date prevents the message from being delivered to
consumers after it has expired.
The message producer may assign a priority to a message when it is delivered.
There are two categories of message priorities:
levels 0-4 are gradations of normal priority; levels 5-9 are gradations of expedited priority.
.Developer-Assigned Headers.
There are three basic categories of message properties: application-specific properties,
JMS-defined properties, and provider-specific properties.
.Client-Acknowledged Messages.
There are three
acknowledgment modes that may be set by the JMS consumer when its session is created:
AUTO_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, and CLIENT_ACKNOWLEDGE.
The pub/sub model is based on a push model, which means that consumers are delivered
messages without having to request them. Messages are exchanged through a virtual
channel called a topic. From the viewpoint of the receiver, a p2p queue can either push or
pull messages, depending on whether it uses the asynchronous onMessage( ) callback, or a
synchronous receive( ) method.
One important difference between point-topoint
and publish/subscribe messaging is that p2p messages are always delivered,
regardless of the current connection status of the receiver.
:Transacted Messages
::message-driven beans

Point-to-Point
Publish-and-Subscribe

Topic
Queue

Arquitetura Centralizada
Tem um servidor de mensageria central

Arquitetura Descentralizada
Usa IP multicast
Algumas funcionalidades tais como (persistencia, transações, segurança), são utilizadas no próprio cliente localmente.

JMS
ConnectionFactory
Destination
JNDI
Topic
Queue

Messages
Text, Object, Bytes, Map, Stream

Mensagens Persistentes

Expiração

Prioridade (de 0 a 4; de 5 a 9)

Selectores de Mensagens

Somente-Leitura

DUPS_OK_ACKNOWLEDGE
Aceita receber mais de uma vez a mensagem

AUTO_ACKNOWLEDGE O produtor manda a mensagem para o servidor, que fica aguardando, uma resposta, assim que o servidor confirma, o produtor finaliza o envio.
O servidor envia para o cliente, e assim que o cliente confirma que recebeu, o servidor encerra o processo.
Se o servidor não receber a confirmação, depois de um tempo, ele tenta enviar novamente.
Nesse processo, pode ser implementadas maneiras de controlar quantas vezes foram feitas tentativas de envios, por exemplo, gravando em banco de dados, etc.

Mensagens com transação

Message Driven Beans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment