-
Instant Messaging in Java Made Easy: The Smack API (11 messages)
- Posted by: Joseph Ottinger
- Posted on: October 06 2006 12:21 EDT
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?Threaded Messages (11)
- Re: Instant Messaging in Java Made Easy: The Smack API by Dan Diephouse on October 06 2006 14:12 EDT
- Re: Instant Messaging in Java Made Easy: The Smack API by Henrique Steckelberg on October 06 2006 14:32 EDT
- Re: Instant Messaging in Java Made Easy: The Smack API by Sean Sullivan on October 06 2006 02:36 EDT
- Re: Instant Messaging in Java Made Easy: The Smack API by Sunny Liu on October 06 2006 10:55 EDT
- Re: Instant Messaging in Java Made Easy: The Smack API by Henrique Steckelberg on October 06 2006 14:32 EDT
- Re: Instant Messaging in Java Made Easy: The Smack API by Matt Tucker on October 06 2006 14:42 EDT
- Re: Instant Messaging in Java Made Easy: The Smack API by Raj Rajen on October 09 2006 13:48 EDT
- Re: Instant Messaging in Java Made Easy: The Smack API by Rickard Oberg on October 10 2006 05:19 EDT
- Re: Instant Messaging in Java Made Easy: The Smack API by Kevin Kalmbach on October 10 2006 12:51 EDT
- Re: Instant Messaging in Java Made Easy: The Smack API by Raj Rajen on October 09 2006 13:48 EDT
- Re: Instant Messaging in Java Made Easy: The Smack API by Ross Mason on October 08 2006 01:19 EDT
- Server interaction integration by Rickard Oberg on October 09 2006 04:51 EDT
- Smack API sendMessage is not happening for me by Vijesh Viswanathan on February 12 2009 02:51 EST
-
Re: Instant Messaging in Java Made Easy: The Smack API[ Go to top ]
- Posted by: Dan Diephouse
- Posted on: October 06 2006 14:12 EDT
- in response to Joseph Ottinger
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. -
Re: Instant Messaging in Java Made Easy: The Smack API[ Go to top ]
- Posted by: Henrique Steckelberg
- Posted on: October 06 2006 14:32 EDT
- in response to Dan Diephouse
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. -
Re: Instant Messaging in Java Made Easy: The Smack API[ Go to top ]
- Posted by: Sean Sullivan
- Posted on: October 06 2006 14:36 EDT
- in response to Henrique Steckelberg
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 -
Re: Instant Messaging in Java Made Easy: The Smack API[ Go to top ]
- Posted by: Sunny Liu
- Posted on: October 06 2006 22:55 EDT
- in response to Henrique Steckelberg
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. -
Re: Instant Messaging in Java Made Easy: The Smack API[ Go to top ]
- Posted by: Matt Tucker
- Posted on: October 06 2006 14:42 EDT
- in response to Joseph Ottinger
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/ -
Re: Instant Messaging in Java Made Easy: The Smack API[ Go to top ]
- Posted by: Raj Rajen
- Posted on: October 09 2006 13:48 EDT
- in response to Matt Tucker
Cool, I had no idea that article was being written (and am the original Smack author). :-)
@Matt, can you please elaborate a bit more on the above point. Thanks
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. -
Re: Instant Messaging in Java Made Easy: The Smack API[ Go to top ]
- Posted by: Rickard Oberg
- Posted on: October 10 2006 05:19 EDT
- in response to Raj Rajen
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.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 -
Re: Instant Messaging in Java Made Easy: The Smack API[ Go to top ]
- Posted by: Kevin Kalmbach
- Posted on: October 10 2006 12:51 EDT
- in response to Raj Rajen
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..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 -
Re: Instant Messaging in Java Made Easy: The Smack API[ Go to top ]
- Posted by: Ross Mason
- Posted on: October 08 2006 01:19 EDT
- in response to Joseph Ottinger
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 -
Server interaction integration[ Go to top ]
- Posted by: Rickard Oberg
- Posted on: October 09 2006 04:51 EDT
- in response to Joseph Ottinger
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. -
Smack API sendMessage is not happening for me[ Go to top ]
- Posted by: Vijesh Viswanathan
- Posted on: February 12 2009 02:51 EST
- in response to Joseph Ottinger
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