Artemis and Wildfly16

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Artemis and Wildfly16

Rafael Fernandez
Good evening.

I have been trying to set up Wildfly16 with support to MQTT on JMS.

After a week trying to set  the system I have to say I am not been able to
have the system fully working.

Then I moved to standalone Artemis to get the hang of working with this
software.

To my surprise my first artemis broker is running. To test configuration I
have developed small Java clients for JMS queue producer/consumer and MQTT
publisher/suscriber. So I can exchange messages among all of them.

Trying to do the same in Wildfly I am facing these problems:

-- I can produce/consume to/from a queue from JMS producer/consumer.
-- I can publish to a queue from a MQTT publisher.

-- I have not been able to subscribe to a queue from a MQTT subscriber.

To discard problems in the Java clients I have used MQTTBOX as well an I
have the same problem unable to subscribe to a queue from MQTT.

Thanks in advanced.

Follow my standalone-full.xml

 <subsystem xmlns="urn:jboss:domain:messaging-activemq:6.0">

...            
    <remote-connector name="mqtt-connector" socket-binding="mqtt"/>
                <in-vm-connector name="in-vm" server-id="0">
                   
                </in-vm-connector>
                <http-acceptor name="http-acceptor"
http-listener="default"/>
                <http-acceptor name="http-acceptor-throughput"
http-listener="default">
                   
                   
                </http-acceptor>
                <remote-acceptor name="mqtt-acceptor" socket-binding="mqtt">
                   
                </remote-acceptor>
                <in-vm-acceptor name="in-vm" server-id="0">
                   
                </in-vm-acceptor>
                <jms-queue name="ExpiryQueue"
entries="java:/jms/queue/ExpiryQueue"/>
                <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
                <jms-queue name="jms.queue.Q1"
entries="java:/jms/queue/jms.queue.Q1
java:jboss/exported/queue/jms.queue.Q1" durable="true"/>
                <connection-factory name="InVmConnectionFactory"
entries="java:/ConnectionFactory" connectors="in-vm"/>
                <connection-factory name="RemoteConnectionFactory"
entries="java:jboss/exported/jms/RemoteConnectionFactory"
connectors="http-connector mqtt-connector"/>
                <pooled-connection-factory name="activemq-ra"
entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory"
connectors="in-vm" transaction="xa"/>
   ...



...
        <socket-binding name="mqtt" port="1883"/>
...



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Artemis and Wildfly16

jbertram
Are you getting an exception or error message on the client which provides
any additional information about what the problem might be when the
subscription attempt fails? Is anything logged in the server's log file?

You shouldn't need to define that "mqtt-connector" or specify it in the
"RemoteConnectionFactory" since MQTT clients don't use JNDI and therefore
don't look up connection factories. That may even break normal JMS clients
which use that connection factory.


Justin

On Sun, Apr 21, 2019 at 8:17 AM Rafael Fernandez <[hidden email]> wrote:

> Good evening.
>
> I have been trying to set up Wildfly16 with support to MQTT on JMS.
>
> After a week trying to set  the system I have to say I am not been able to
> have the system fully working.
>
> Then I moved to standalone Artemis to get the hang of working with this
> software.
>
> To my surprise my first artemis broker is running. To test configuration I
> have developed small Java clients for JMS queue producer/consumer and MQTT
> publisher/suscriber. So I can exchange messages among all of them.
>
> Trying to do the same in Wildfly I am facing these problems:
>
> -- I can produce/consume to/from a queue from JMS producer/consumer.
> -- I can publish to a queue from a MQTT publisher.
>
> -- I have not been able to subscribe to a queue from a MQTT subscriber.
>
> To discard problems in the Java clients I have used MQTTBOX as well an I
> have the same problem unable to subscribe to a queue from MQTT.
>
> Thanks in advanced.
>
> Follow my standalone-full.xml
>
>  <subsystem xmlns="urn:jboss:domain:messaging-activemq:6.0">
>
> ...
>                 <remote-connector name="mqtt-connector"
> socket-binding="mqtt"/>
>                 <in-vm-connector name="in-vm" server-id="0">
>
>                 </in-vm-connector>
>                 <http-acceptor name="http-acceptor"
> http-listener="default"/>
>                 <http-acceptor name="http-acceptor-throughput"
> http-listener="default">
>
>
>                 </http-acceptor>
>                 <remote-acceptor name="mqtt-acceptor"
> socket-binding="mqtt">
>
>                 </remote-acceptor>
>                 <in-vm-acceptor name="in-vm" server-id="0">
>
>                 </in-vm-acceptor>
>                 <jms-queue name="ExpiryQueue"
> entries="java:/jms/queue/ExpiryQueue"/>
>                 <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
>                 <jms-queue name="jms.queue.Q1"
> entries="java:/jms/queue/jms.queue.Q1
> java:jboss/exported/queue/jms.queue.Q1" durable="true"/>
>                 <connection-factory name="InVmConnectionFactory"
> entries="java:/ConnectionFactory" connectors="in-vm"/>
>                 <connection-factory name="RemoteConnectionFactory"
> entries="java:jboss/exported/jms/RemoteConnectionFactory"
> connectors="http-connector mqtt-connector"/>
>                 <pooled-connection-factory name="activemq-ra"
> entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory"
> connectors="in-vm" transaction="xa"/>
>    ...
>
>
>
> ...
>         <socket-binding name="mqtt" port="1883"/>
> ...
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Artemis and Wildfly16

Rafael Fernandez
Hi Justin

Thank you for yours advise. It gave me the clue to solve the problem.
Setting the Wildfly log to debug provided usefull info.

After an in deep reading of  Apache Artemis user manual, and having carried
out many tests and configurations on both, standalone and wildfly16
embedded, I have been able to run the Artemis in Wildfly with Mqtt support.

As I mentioned in my original question there was impossible to subscribe to
a queue or topic from mqtt client, however it was possible to send messages
to that queue/topic.

If you read the Artemis manual, the information regarding the subscriptions
to queues or topics clearly explains how subscription and publishing it is
carried out.

In Artemis there are addresses and queues, the topic concept does not
exists.

If autocreate-address and autocreate-queues is enabled, clients when publish
will create the addresses and queues.

The clients when subscribe will create address and queues as well. If there
is more than one subscribers each one will create an queue attached to the
address.

So when a client publish, sends messages to the address and Artemis routes
the messages to the attached queues.

There are statics addresses and queues that are defined in broker.xml. A
client can subscribe to those static addresses and will create a dinamic
queue each one to receive messages. Or If the programmer desires can code
the client so as to attached to a static queue defined in broker.xml by
means of the fully qualyfied name.

broker.xml  static addres and queue
 </address>
     <address name="test">
            <multicast>
               <queue name="T1" />
            </multicast>
    </address>

client, field for fully qualyfied name
  private String topic = "test::T1";

So in conclusion if you want to subscribe to a Wildfly16 Artemis from a Mqtt
client you should set the standalone-full.xml to allow autocreation of
queues.

<address-setting name="#" dead-letter-address="jms.queue.DLQ"
expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760"
page-size-bytes="2097152" message-counter-history-day-limit="10"
auto-create-queues="true" auto-delete-queues="true"
auto-create-addresses="true" auto-delete-addresses="true"/>

And that is all, allow the clients to create their own queues atached to the
addresses.


Now I will try to set SSL support for Artemis in Wildfly16

Rafael




--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Artemis and Wildfly16

jbertram
Thanks for the update.

I think everything you said is correct. The initial confusion may have been
caused by the way the messaging subsystem in Wildfly exposes the Artemis
configuration. It's really meant to be used only as a JMS server so the
messaging subsystem configuration is geared towards that use-case. It's not
as flexible or abstract as the configuration for the standalone Artemis
broker.


Justin

On Thu, May 23, 2019 at 12:30 PM Rafael Fernandez <[hidden email]>
wrote:

> Hi Justin
>
> Thank you for yours advise. It gave me the clue to solve the problem.
> Setting the Wildfly log to debug provided usefull info.
>
> After an in deep reading of  Apache Artemis user manual, and having carried
> out many tests and configurations on both, standalone and wildfly16
> embedded, I have been able to run the Artemis in Wildfly with Mqtt support.
>
> As I mentioned in my original question there was impossible to subscribe to
> a queue or topic from mqtt client, however it was possible to send messages
> to that queue/topic.
>
> If you read the Artemis manual, the information regarding the subscriptions
> to queues or topics clearly explains how subscription and publishing it is
> carried out.
>
> In Artemis there are addresses and queues, the topic concept does not
> exists.
>
> If autocreate-address and autocreate-queues is enabled, clients when
> publish
> will create the addresses and queues.
>
> The clients when subscribe will create address and queues as well. If there
> is more than one subscribers each one will create an queue attached to the
> address.
>
> So when a client publish, sends messages to the address and Artemis routes
> the messages to the attached queues.
>
> There are statics addresses and queues that are defined in broker.xml. A
> client can subscribe to those static addresses and will create a dinamic
> queue each one to receive messages. Or If the programmer desires can code
> the client so as to attached to a static queue defined in broker.xml by
> means of the fully qualyfied name.
>
> broker.xml  static addres and queue
>  </address>
>      <address name="test">
>             <multicast>
>                <queue name="T1" />
>             </multicast>
>     </address>
>
> client, field for fully qualyfied name
>   private String topic = "test::T1";
>
> So in conclusion if you want to subscribe to a Wildfly16 Artemis from a
> Mqtt
> client you should set the standalone-full.xml to allow autocreation of
> queues.
>
> <address-setting name="#" dead-letter-address="jms.queue.DLQ"
> expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760"
> page-size-bytes="2097152" message-counter-history-day-limit="10"
> auto-create-queues="true" auto-delete-queues="true"
> auto-create-addresses="true" auto-delete-addresses="true"/>
>
> And that is all, allow the clients to create their own queues atached to
> the
> addresses.
>
>
> Now I will try to set SSL support for Artemis in Wildfly16
>
> Rafael
>
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Artemis and Wildfly16

Rafael Fernandez
Hi Justin.

Let me a last question.

The idea of useing Wildfly as an application server comes from a personal
project I developed a couple of years ago. It was a JEE application software
for tracking vehicles. The comunication with tracking devices was based on
Web services. Now the trend in tracking devices in Mqtt so I am thinking
about to migrate my project from web services to mqtt.

I would like to know your opinion, wether I should use Wildfly Artemis as a
MOM or it would be better to use Artemis standalone and subscribe to it from
my project running in Wildfly

Regards

Rafael





--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Artemis and Wildfly16

jbertram
In my opinion the greatest power and flexibility comes when running the
broker standalone. Then you can scale up if necessary (e.g. "horizontally"
via clustering or "vertically" via better hardware), configure high
availability, easily add support for other protocols, etc. without having
to deal with an application layer that's tied to the broker. Then your
applications (e.g. your MQTT devices, your project running in Wildfly,
etc.) can access the broker however they need.


Justin


On Thu, May 23, 2019 at 1:23 PM Rafael Fernandez <[hidden email]> wrote:

> Hi Justin.
>
> Let me a last question.
>
> The idea of useing Wildfly as an application server comes from a personal
> project I developed a couple of years ago. It was a JEE application
> software
> for tracking vehicles. The comunication with tracking devices was based on
> Web services. Now the trend in tracking devices in Mqtt so I am thinking
> about to migrate my project from web services to mqtt.
>
> I would like to know your opinion, wether I should use Wildfly Artemis as a
> MOM or it would be better to use Artemis standalone and subscribe to it
> from
> my project running in Wildfly
>
> Regards
>
> Rafael
>
>
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>