Message Driven Beans (MDB)

Deprecated

Lives

  • Trecho da live do dia 24/06/2021 sobre Message Driven Beans

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

Copyright © 2024 RPM Hub. Distributed by CC-BY-4.0 license.