Instant Messaging in Java Made Easy: The Smack API

Home

News: Instant Messaging in Java Made Easy: The Smack API

  1. Java.net has published "Instant Messaging in Java Made Easy: The Smack API," by John Ferguson Smart. It covers Smack, which is a client library for using XMPP (the Jabber protocol); articles like this could clear the way for someone writing a resource adapter for J2EE applications sending out messages or listening for specific messages. What would you think of being able to interact with a server, even a development server, with GAIM or Trillian? Connectors already exist to feed email through an EJB (see the Java EE Code Samples & Apps page, the JavaEE 1.4_04 samples, the mailconnector sample in specific). Would something like this be useful?
  2. Smack is a pretty cool little library I was able to write XFire integration with it pretty easily. Although I haven't written any documentation on it, so if you want to use it you'd better be willing to look at the sources :-) I'd be interested to hear if people are writing Java business applications with XMPP or if thats remaining a theoretical thing at this point.
  3. I don't know about server side use, but I'd like to see a Eclipse plug-in for instant messaging using this protocol, like Idea 6.0 has.
  4. I'd like to see a Eclipse plug-in for instant messaging using this protocol, like Idea 6.0 has.
    http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/eclipse/ecf/provider/xmpp/package-summary.html http://www.eclipse.org/ecf/org.eclipse.ecf.docs/api/org/eclipse/ecf/provider/xmpp/smack/package-summary.html
  5. I don't know about server side use, but I'd like to see a Eclipse plug-in for instant messaging using this protocol, like Idea 6.0 has.
    I read that article a few days ago. I also tried the smack API, it is really nice stuff, I was think to create a small plugin for eclipse with google talk server. Implementation is very neat and clean. Great work! Jivesoftware team.
  6. Cool, I had no idea that article was being written (and am the original Smack author). :-) One idea that hasn't caught on as much as I think it will yet is that XMPP can be for *much* more than instant messaging. For a lot of use-cases, it's much better suited (and easier to use) than the web services protocols. The fact that presence is built-in to the protocol is something just totally unique compared to almost everything else out there. A few things that Java dev might find interesting: * Pubsub support in XMPP. It's actually a very robust pubsub model and is already supported in Wildfire (our Open Source XMPP server). Smack support for pubsub is coming soon. Read more at: http://www.jivesoftware.org/articles/pubsub.jsp * IntelliJ IDEA 6.0's collaboration features are built using XMPP and Smack. Check out my blog entry on this: http://jivesoftware.com/blog/2006/10/05/intellijoin-launch/
  7. Cool, I had no idea that article was being written (and am the original Smack author). :-)

    One idea that hasn't caught on as much as I think it will yet is that XMPP can be for *much* more than instant messaging.
    @Matt, can you please elaborate a bit more on the above point. Thanks
  8. Cool, I had no idea that article was being written (and am the original Smack author). :-)

    One idea that hasn't caught on as much as I think it will yet is that XMPP can be for *much* more than instant messaging.


    @Matt, can you please elaborate a bit more on the above point.

    Thanks
    I posted two examples: remote logging and scripting. Since you can attach custom XML/files to messages you could also use it for all sorts of SOA/server communication needs, i.e. not involving humans at all.
  9. Cool, I had no idea that article was being written (and am the original Smack author). :-)

    One idea that hasn't caught on as much as I think it will yet is that XMPP can be for *much* more than instant messaging.


    @Matt, can you please elaborate a bit more on the above point.

    Thanks
    I think Matt was talking about using XMPP as a transport mechanism for non-IM uses such as an ESB, JMS, remote EJB's etc. The XMPP server already take care of things like presence management, storing messages until the component becomes available, sending messages to remote servers, etc..
  10. This is a nice, clean API and implementation. We've been using it in Mule for some time now to enable users can consume and dispatch events over XMPP. We were up and running with it in no time. Good work guys! Cheers, Ross
  11. Server interaction integration[ Go to top ]

    I've used Smack/XMPP to do log4j integration, so that critical errors from servers are sent to my Trillian installation. I've also toyed with using Smack to interact with a BeanShell engine in the server to be able to easily do remote scripting and debugging. Send the script as an IM, have it run on the server, and then get the script results back as an IM. Pretty neat.
  12. Hi All, Thanks in Advance I am very new to Smack API. I have started using it from last one month only. So If you find this as a silly question, just dont feel bad and help me out to make my Application work. And also If this is not the right place in this forum to ask such doubts, kindly inform me Application Description. I am building an IM client with Openfire as my chat server and I am communicating with openfire through the Smack API. I am also using the Spark client parallely foir testing purpose. I am able to do the following things. 1) Login 2) Populate my friend's list from Roster 3) Detect the presence of my friends. 4) Get the Chat history of my friends(Currently everything is coming as null.but timestamp is displayed properly) 5) Iam able to chat with the Spark Client Problem Description 1) When I am sending the message from a user to another user, It is not able to send the Message. I suppose the flow is broken in the sendMessage method of the Chat Class. 2) When I am sending the message, I am getting back a null from the Jabber. I am pasting my send and process method below public void send(String sender, String message) throws XMPPException { Chat chat = fChat.getChat();// This is getting a chat object properly if(chat!=null) { System.out.println("Sending message to " + sender + " Message:"+message); Message msg = new Message(); msg.setFrom(this.username); msg.setBody(message); chat.sendMessage(msg);// I think it is broken in this line only. And I also think it is not sending the message to jabber } } } public void process(Chat chat, Message message) { String from = message.getFrom(); int slashIndex = from.indexOf("/"); slashIndex = slashIndex == -1 ? from.length() : slashIndex; from = from.substring(0, slashIndex); FriendChat fChat = (FriendChat) this.friendChatMap.get(from); fChat.setChat(chat); String msg = message.getBody(); fChat.addMessage(msg, false); this.publish(Constants.TOPIC_NAME_PREFIX+"/"+toSimpleUserId(this.getUserName()), "{from:'"+toSimpleUserId(from)+"',message:'"+msg+" '}");// this publish is used to publish this message to the client } Could you please point out what can be the problem with this code. Believe me I have followed all the basic rules of Smack API Thanks in Advance Vijesh