1

I configured spring integration with xmpp and I can send message to other jid. To build the message I use the following method:

Message<?> message = MessageBuilder.withPayload("Test Message").
        setHeader(XmppHeaders.TO, "pino@chiarottos-macbook-pro.local").
        build();
messageChannel.send(message);

Now I would like to create a chat room, I tried to figured how to build a message containing a multi user chat request without success.

Any help?

using: XmppHeaders.TYPE set to "groupchat" and XmppHeaders.TO to "myroommmm" does not work.. The xmpp server log:

[info] <0.609.0>@ejabberd_c2s:open_session:1105 ({socket_state,gen_tcp,#Port<0.16208>,<0.608.0>}) Opened session for chiarotto@chiarottos-macbook-pro.local/resource 2016-04-12 15:55:40.987 [info] <0.609.0>@ejabberd_s2s:new_connection:406 New s2s connection started <0.611.0> 

[info] <0.611.0>@ejabberd_s2s_out:log_s2s_out:1253 Trying to open s2s connection: chiarottos-macbook-pro.local -> myroommmmme with TLS=false 2016-04-12 15:55:40.999 [info] <0.611.0>@ejabberd_s2s_out:open_socket:246 s2s connection: chiarottos-macbook-pro.local -> myroommmmme (remote server not found)

I'm running an integration test

Upadate 2: Using:

MultiUserChat multiUserChat = new MultiUserChat(xmppConnection,"prova");
        try {
            multiUserChat.join("soisdjdsoijds");
        } catch (XMPPException.XMPPErrorException e) {
            e.printStackTrace();
        } catch (SmackException e) {
            e.printStackTrace();
        }

I get the folling error:

remote-server-not-found
    at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:196)
    at org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:352)
    at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:516)
    at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:451)
    at radiosa.service.muc.MUCService.testRoom(MUCService.java:83)

(The server is correctly configured and It is working)

chiarotto.alessandro
  • 1,491
  • 1
  • 13
  • 31

1 Answers1

1

The ChatMessageSendingMessageHandler is designed only for sending messages.

All the multi-user chat management (creat, join, leave etc.) must be done via org.jivesoftware.smackx.muc.MultiUserChatManager.

Although you still can send message there using ChatMessageSendingMessageHandler:

  • The XmppHeaders.TO header must be a room name according to the JavaDocs:

    * @param jid the name of the room in the form "roomName@service", where "service" is the hostname at which the
    *        multi-user chat service is running. Make sure to provide a valid JID.
    */
    public synchronized MultiUserChat getMultiUserChat(String jid) { 
    
  • And the XmppHeaders.TYPE header must be as a value of Message.Type.groupchat

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • thanks, if I use MultiUserChatManager I have to pass it my XMPPConnection bean? By the way I'm using the latest version of spring-integration-xmpp (4.2.5) and It depends on a smack version that doesn't contains MultiUserChatManager. – chiarotto.alessandro Apr 12 '16 at 13:43
  • Yeah... I see. Looks like it has been introduced since `Smack 4.1.x`. We support that since SI-4.3. I guess you can do the same via just `MultiUserChat`: `public MultiUserChat(XMPPConnection connection, String room)`. – Artem Bilan Apr 12 '16 at 13:51
  • But Using MultiUserChat I would not use channel anymore,just xmppconnection, right? I would like to use channel and just send minimal info to my xmpp server in order to create the room. – chiarotto.alessandro Apr 12 '16 at 13:54
  • I think you have to `join` milti-user chat first of all, before sending the message. And I said you already: via `ChatMessageSendingMessageHandler` you only can send `Message` Packet to the `xmppconnection`. You have to use `MultiUserChat` directly for any group-chat management. Although you can wrap all the operation into the `service-activator` and send command messages to manage the chat. – Artem Bilan Apr 12 '16 at 14:02
  • See you logs: `remote server not found`. That is not Spring Integration problem. Sorry. – Artem Bilan Apr 12 '16 at 14:04
  • thanks, my local server works, if I send a message to another jid using the same integration test everythings works. The error is showed with the muc creation attempt. I'm not saying that spring does not work. I'm asking help to achieve my goal. – chiarotto.alessandro Apr 12 '16 at 14:07
  • Yeah... I'm not familiar with `MultiUserChat`. I added a `Smack` tag to your question with hope that someone from the Ignite Realtime will take a look. – Artem Bilan Apr 12 '16 at 14:09
  • "Although you can wrap all the operation into the service-activator and send command messages to manage the chat" there is an example on internet? For me it's like arab :-) – chiarotto.alessandro Apr 12 '16 at 14:21
  • M-m-m. No, of course, no. That is out of Spring Integration scope. And even more: such a logic doesn't feet the EIP purpose. So, I'd recommend just use `MultiUserChat` chat directly for management. – Artem Bilan Apr 12 '16 at 14:25