Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Message Driven Beans (MDB)

Deprecated

Lives

Implementando um MDB

O vídeo abaixo mostra um exemplo de como podemos implementa um MDB no Open Liberty por meio do VSCode

Para fazer um clone do resultado final apresentado no vídeo digite:

git clone `https://github.com/rodrigoprestesmachado/pw2`
cd `pw2`
git checkout 77b5968549588820266e26a894998a1b296fa8db

Configuração do Open Liberty utilizada no vídeo

  <!--
        Tutorial:
        https://rieckpil.de/howto-simple-jms-application-with-the-embedded-messaging-engine-in-open-liberty/

        https://openliberty.io/docs/21.0.0.5/reference/config/messagingEngine.html
    -->
    <messagingEngine>
        <queue id="QUEUE1" />
    </messagingEngine>

    <!--
        https://openliberty.io/docs/21.0.0.5/reference/config/jmsQueueConnectionFactory.html
    -->
    <jmsQueueConnectionFactory jndiName="jms/JmsFactory">
        <properties.wasJms remoteServerAddress="localhost:7276:BootStrapBasicMessaging" />
    </jmsQueueConnectionFactory>

    <!--
        https://openliberty.io/docs/21.0.0.5/reference/config/jmsQueue.html
    -->
    <jmsQueue id="simpleJmsQueue" jndiName="jms/MyQueue">
        <properties.wasJms queueName="QUEUE1" />
    </jmsQueue>

    <!--
        https://openliberty.io/docs/21.0.0.5/reference/config/jmsActivationSpec.html
    -->
    <jmsActivationSpec id="demo/MDB">
        <properties.wasJms destinationRef="simpleJmsQueue" destinationType="javax.jms.Queue" remoteServerAddress="localhost:7276:BootstrapBasicMessaging"/>
    </jmsActivationSpec>

Referência

The Jakarta® EE Tutorial

Rodrigo Prestes Machado
CC BY 4.0 DEED