Getting start

Hi, I would like use smack for send notification over internet from spring application, on pivotal server to android device.

I use openfire between client server applications. Now I follow getting starting tutorial on spring

// Create a connection to the jabber.org server. AbstractXMPPConnection conn1 = new XMPPTCPConnection("user", "XXXX" "127.0.0.1"); conn1.connect();  // Create a connection to the jabber.org server on a specific port. XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()   .setUsernameAndPassword("user", "XXXX")   .setXmppDomain("openfire")   .setHost("127.0.0.1")   .setPort("9090")   .build();  AbstractXMPPConnection conn2 = **new** XMPPTCPConnection(config); conn2.connect();
// Create a connection to the jabber.org server. AbstractXMPPConnection conn1 = **new** XMPPTCPConnection("username", "password" "jabber.org"); conn1.connect();  // Create a connection to the jabber.org server on a specific port. XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()   .setUsernameAndPassword("username", "password")   .setXmppDomain("jabber.org")   .setHost("earl.jabber.org")   .setPort("8222")   .build();  AbstractXMPPConnection conn2 = **new** XMPPTCPConnection(config); conn2.connect();

I ask two question:

Can I use this library on spring for a webapplication xmpp client? Is there a tutorial for do that?

Can I use this library for push message (chat message) on android device ? I would like to simulate a push notification for start specific task on android device trough chat Xmpp smack mechanism.

tnx

Ok I make an Android client that connect to openfire server and send message and listen for incoming messages.

I also make a spring class that send message to android client trought openfire server below i put code class

public class CustomConnectionConfiguration {

public static void main(String[] args) {

try {

XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()

.setUsernameAndPassword(“test1”, “test1”)

.setServiceName(“openfire”)

.setHost(“172.16.1.143”)

.setPort(5222)

.build();

AbstractXMPPConnection conn2 = new XMPPTCPConnection(config);

conn2.connect();

conn2.login();

ChatManager chatmanager = ChatManager.getInstanceFor(conn2);

Chat newChat = chatmanager.createChat(“test@neanb330”, new ChatMessageListener() {

@Override

public void processMessage(Chat chat, Message message) {

// TODO Auto-generated method stub

System.out.println("Received message: " + message);

}

});

newChat.sendMessage(“Bombolo”);

} catch (SmackException | IOException | XMPPException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

Now when i Start main class I sand a chat message then process end.

How I can create a infinite loop in spring class to listening incoming message? I try to create trhead in main class but i get an error, is expected in smack any method that do the job?

tnx