Dúvida com Persistencia em filas JMS[RESOLVIDO]

1 resposta
romarcio

:?: Estou com uma dúvida em persistência no envio de uma mensagem para uma fila JMS.

Por exemplo:

QueueSender sender = ...; sender.send(jmsMessage, DeliveryMode.PERSISTENT, priority, 0);

jmsMessage: corpo da mensagem
DeliveryMode.PERSISTENT : mensagem persistente no container jms
priority: prioridade
0 : para que serve esse atributo ?

E alguêm teria realmete um bom conceito para explicar o DeliveryMode.PERSISTENT e o DeliveryMode.NON_PERSISTENT. Tipo quando usar um ou outro no envio de uma mensagem para a fila jms.

1 Resposta

romarcio

Entendi pela documentação:

public void send(Message message, int deliveryMode, int priority, long timeToLive)
          throws JMSException

    Sends a message to the queue, specifying delivery mode, priority, and time to live.

    Specified by:
        send in interface MessageProducer

    Parameters:
        message - the message to send
        deliveryMode - the delivery mode to use
        priority - the priority for this message
        timeToLive - the message's lifetime (in milliseconds) 
    Throws:
        JMSException - if the JMS provider fails to send the message due to some internal error. 
        MessageFormatException - if an invalid message is specified. 
        InvalidDestinationException - if a client uses this method with a QueueSender with an invalid queue. 
        UnsupportedOperationException - if a client uses this method with a QueueSender that did not specify a queue at creation time.
    See Also:
        Session.createProducer(javax.jms.Destination)
Criado 7 de janeiro de 2010
Ultima resposta 1 de set. de 2010
Respostas 1
Participantes 1