2

I am creating a simple Thorntail service that will write a text message to a remote ActiveMQ queue, and have that message consumed by an MDB. To test this, I've got ActiveMQ running in a local Docker container. The relevant portion of my docker-compose.yml file looks like this:

activemq:
  image: webcenter/activemq
  ports:
      - 1883:1883
      - 5672:5672
      - 8161:8161
      - 61613:61613
      - 61614:61614
      - 61616:61616
  environment:
      - ACTIVEMQ_CONFIG_NAME=holocron-mq
      - ACTIVEMQ_CONFIG_DEFAULTACCOUNT=false
      - ACTIVEMQ_ADMIN_LOGIN=mqadmin
      - ACTIVEMQ_ADMIN_PASSWORD=password
      - ACTIVEMQ_CONFIG_QUEUES_queue1=myqueue1
      - ACTIVEMQ_CONFIG_SCHEDULERENABLED=true
      - ACTIVEMQ_USERS_edgeproducer=password
      - ACTIVEMQ_USERS_edgeconsumer=password

My Thorntail project-defaults.yml file has been configured to connect to this "remote" server with this configuration:

swarm:
  network:
    socket-binding-groups:
      standard-sockets:
        outbound-socket-bindings:
          remote-activemq-socket-binding:
            remote-host: 127.0.0.1
            remote-port: 61616
  messaging-activemq:
    servers:
      default:
        remote-connectors:
          remote-activemq-connector:
            socket-binding: remote-activemq-socket-binding
        pooled-connection-factories:
          remote-connection-factory:
            user: edgeproducer
            password: password
            connectors:
              - remote-activemq-connector
            entries:
              - 'java:/jms/remote-mq'
              - 'java:/DefaultJMSConnectionFactory'
        jms-queues:
          session-tracking-queue:
            entries:
              entry: 'java:/jms/queue/testQueue'

My JAX-RS service has the following 2 JMS properties to (eventually) allow me to write to the queue:

@Inject
@JMSConnectionFactory("java:/jms/remote-mq")
private JMSContext jmsContext = null;

@Resource(mappedName = "java:/jms/queue/testQueue")
private Queue processingQueue = null;

Finally, my MDB has the following annotations to allow it to read from the queue:

@MessageDriven(activationConfig = {
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/jms/queue/testQueue"),
        @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "10") })
@ResourceAdapter("remote-connection-factory")

However, when I start my Thorntail uberjar, I get the following errors:

AMQ214031: Failed to decode buffer, disconnect immediately.: java.lang.IllegalStateException: java.lang.IllegalArgumentException: AMQ119032: Invalid type: 1
AMQ212037: Connection failure has been detected: java.lang.IllegalArgumentException: AMQ119032: Invalid type: 1 [code=GENERIC_EXCEPTION]

I'm not sure exactly what I've missed in my configuration that is causing this issue. Can anyone shed any light on what I'm doing wrong?

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
Shadowman
  • 11,150
  • 19
  • 100
  • 198
  • Which version of ActiveMQ are you using ? It seems that http://activemq.2283324.n4.nabble.com/Artemis-2-4-0-Issues-with-memory-leaks-and-JMS-message-redistribution-tt4736891.html#a4737514 had a similar problem and an upgrade helped... – Axel Podehl May 20 '19 at 08:32
  • The Docker image I'm using is for ActiveMQ 5.14.3. Any idea what version might solve the issue? – Shadowman May 21 '19 at 18:46
  • this guy had the same issue [org.apache.activemq.artemis.core.client] AMQ214031: Failed to decode buffer, disconnect immediately.: java.lang.IllegalStateException: java.lang.IllegalArgumentException: AMQ119032: Invalid type: 1 -- so I guess your issue is related. But from the thread I couldn't figure out the solution. – Axel Podehl May 22 '19 at 06:39

1 Answers1

1

You're attempting to use an ActiveMQ Artemis "core" JMS client (i.e. the default JMS client implementation in Thorntail) with an ActiveMQ 5.x broker. ActiveMQ Artemis is the next-generation of ActiveMQ message broker and the Artemis core JMS client can't talk to the 5.x broker. I recommend you use ActiveMQ Artemis in your Docker container. It is backwards compatible with the OpenWire JMS client implementation which the 5.x broker supports and it also supports all the other protocols (e.g. AMQP, STOMP, MQTT).

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
  • Boom! That did it! Thanks for your help! – Shadowman May 22 '19 at 22:18
  • @Shadowman What did you do? Used standalone (docker) Artemis server? I'm using your configuration but I always get the following error: "WFLYCTL0180: Services with missing/unavailable dependencies" => [ "jboss.naming.context.java.module.booking.booking.DefaultJMSConnectionFactory is missing [jboss.naming.context.java.jboss.DefaultJMSConnectionFactory]", "jboss.deployment.unit.\"booking.war\".component.ExampleMdb.CREATE is missing [jboss.ra.remote-connection-factory]" ] – Mike Aug 14 '19 at 21:48