How do I connect a STOMP client to Wildfly?

Konstantin

I would like to expose my WildFly server to STOMP clients but I have not found any recent samples. As I understand it all communication in recent WildFly versions goes through a single socket (listening to 8080 by default). Do I need to change any configuration or is it supported out of the box? Any pointers are appreciated.

Harald Wellmann

It's true WildFly only listens on port 8080 by default (plus port 9990 for management), using HTTP protocol upgrade to switch to different protocols.

However, you can still define additional acceptors for other ports. I don't know whether or not it is possible to use STOMP with protocol upgrade over port 8080, but here's how to configure an additional Netty acceptor for port 5445:

<extension module="org.jboss.as.messaging"/>

<subsystem xmlns="urn:jboss:domain:messaging:2.0">
    <hornetq-server>
        <journal-file-size>102400</journal-file-size>
        <connectors>
            <http-connector name="http-connector" socket-binding="http">
                <param key="http-upgrade-endpoint" value="http-acceptor"/>
            </http-connector>
            <http-connector name="http-connector-throughput" socket-binding="http">
                <param key="http-upgrade-endpoint" value="http-acceptor-throughput"/>
                <param key="batch-delay" value="50"/>
            </http-connector>
            <in-vm-connector name="in-vm" server-id="0"/>
        </connectors>
        <acceptors>
            <http-acceptor name="http-acceptor" http-listener="default"/>
            <http-acceptor name="http-acceptor-throughput" http-listener="default">
                <param key="batch-delay" value="50"/>
                <param key="direct-deliver" value="false"/>
            </http-acceptor>
            <netty-acceptor name="stomp-acceptor" socket-binding="messaging-stomp">
                <param key="protocols" value="STOMP"/>
                <param key="connection-ttl" value="30000"/>
            </netty-acceptor>
            <in-vm-acceptor name="in-vm" server-id="0"/>
        </acceptors>
        <security-settings>
            <security-setting match="#">
                <permission type="send" roles="guest"/>
                <permission type="consume" roles="guest"/>
                <permission type="createNonDurableQueue" roles="guest"/>
                <permission type="deleteNonDurableQueue" roles="guest"/>
            </security-setting>
        </security-settings>
        <address-settings>
            <!--default for catch all-->
            <address-setting match="#">
                <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                <expiry-address>jms.queue.ExpiryQueue</expiry-address>
                <max-size-bytes>10485760</max-size-bytes>
                <page-size-bytes>2097152</page-size-bytes>
                <message-counter-history-day-limit>10</message-counter-history-day-limit>
            </address-setting>
        </address-settings>
        <jms-connection-factories>
            <connection-factory name="InVmConnectionFactory">
                <connectors>
                    <connector-ref connector-name="in-vm"/>
                </connectors>
                <entries>
                    <entry name="java:/ConnectionFactory"/>
                </entries>
            </connection-factory>
            <connection-factory name="RemoteConnectionFactory">
                <connectors>
                    <connector-ref connector-name="http-connector"/>
                </connectors>
                <entries>
                    <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
                </entries>
            </connection-factory>
            <pooled-connection-factory name="hornetq-ra">
                <transaction mode="xa"/>
                <connectors>
                    <connector-ref connector-name="in-vm"/>
                </connectors>
                <entries>
                    <entry name="java:/JmsXA"/>
                    <entry name="java:jboss/DefaultJMSConnectionFactory"/>
                </entries>
            </pooled-connection-factory>
        </jms-connection-factories>
        <jms-destinations>
            <jms-queue name="ExpiryQueue">
                <entry name="java:/jms/queue/ExpiryQueue"/>
            </jms-queue>
            <jms-queue name="DLQ">
                <entry name="java:/jms/queue/DLQ"/>
            </jms-queue>
        </jms-destinations>
    </hornetq-server>
</subsystem>

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
    <socket-binding name="messaging-stomp" port="5445"/>
</socket-binding-group>

In addition, you'll have to create a user account with role guest via add-user.sh. This account will be used by the STOMP client.

Tested on WildFly 8.2.0.Final.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I make JNDI names compatible with both GlassFish and WildFly

Python - how can i make the client to be able to connect multiple times?

I need a java stomp client library that works with ssl

How do I enable on-the-fly compilation of JSPs in Wildfly 9?

How do I undeploy all artifacts from WildFly?

How do I connect Segment.io server and client side events to the same anonymous user?

How do I make Wildfly 10 / Resteasy indicate a serialization exception to the client

Xdebug unable to connect to client, where do I start debugging the debugger?

How to configure Wildfly to connect to RabbitMQ?

How do I activate the AJP port on Wildfly 11?

WebSocket using sockjs-client and stompjs cannot connect if I do not connect immediately after client creation

How can I unconcatenate related entities in Taleo Connect Client?

How do I use relative paths in Taleo Connect Client?

How do I create an OR filter in Taleo Connect Client?

How do I continue my program to run even when my MQTT client does not connect?

How do I access the OpenApi endpoint in WildFly 18+?

How do I connect a 3rd party XMPP client to Cisco's Jabber Video?

How do I get Wildfly to use additional Jackson Datatypes?

How to tell when a Stomp server disconnected from the Stomp.JS client

How do i connect to a sock4 client's network byte address?

How do I connect open VPN Ubuntu server with a windows client?

How do I connect to a QNAP

Wildfly 9 - How do I exclude Jackson

How do i allow someone to connect to a website that needs client authentication cert without the cert but through a vm that has the cert?

How do I specify a Wildfly server version when using wildfly-maven-plugin?

how can i do for an MDB to deploy last on my wildfly

How i can connect http client

How do I connect to a 3rd party ws service in golang as a client with gorilla in golang? Or is it not possible?

How do I connect an Ado.Net client to my NuoDB on Linux Docker