Embeddable messaging component for Java web application - java

In order to satisfy customer requirements, we will need to let users exchange information among each other. The 'messaging system' does not have sophisticated back-end requirements and could be easily implemented with a few tables to store messages and message types.
The problem is that I believe that the requirements on the front-end are very high and usability is very important. In addition I expect this communication's part to become an important part of the system in the long run.
Is there anything that can be directly integrated into a Java web application and adapted to the application's design? What we need is the following interface
From service layer:
send message to user (header, subject)
reply to a message
notification on new message in user inbox (if possible: on current page)
interface to existing user management
Preferably, the component should already have a front-end with the following functionality:
message management (select, remove, reply, delete/restore, ...)
folders: inbox, sent, trash
tagging: message categories
show last x messages in a panel/div
styling to look like the application
If there is something reasonably stable, I would prefer using a component before implementing something like this into the application. The application runs on Wicket, but we are not tied to this framework for the messaging component.
Thank you,
Kariem
In portal servers, you have the flexibility to add portlets that could do something similar to the component I am looking for; e.g. Liferay provides mail and message boards portlets.
As akf points out in a comment Jabber provides a solid basis for messaging. We are looking for something that can be integrated into a web application. If we have to build a lot of UI around Jabber, we cannot really consider it a good fit for our requirements.

Ok, it may be a bit surprising but what about giving the Google Wave a try ?
If I review your criteria :
Is there anything that can be directly
integrated into a Java web application
and adapted to the application's
design [...]
It can be as you will discover on this mini-tutorial : http://blog.zenika.com/index.php?post/2010/01/27/Google-Wave-Embedded-API-the-missing-tutorial (how interesting isn't it ?)
From service layer:
send message to user (header, subject)
reply to a message
notification on new message in user inbox (if possible: on current page)
interface to existing user management
Everything but the last point is offered by the Google Wave instance. The last point may be a bit harder to solve as you will require that all of your user have a googlewave account. Managing those accounts may become available through Google Apps, but atm it's not feasible. If it's absolutely mandatory you could plan to have your own instance since it is an open protocol but your goal was to have something already done for you, right ?
Preferably, the component should
already have a front-end with the
following functionality:
message management (select, remove, reply, delete/restore, ...)
folders: inbox, sent, trash
tagging: message categories
show last x messages in a panel/div
styling to look like the application
Great, all of this is ok with the Wave.
If there is something reasonably
stable, I would prefer using a
component before implementing
something like this into the
application. The application runs on
Wicket, but we are not tied to this
framework for the messaging component.
Ok Wicket is so trendy, you should love this solution :-)
I acknowledge that is a bit 'avant-gardiste', I have never done such a thing myself but thought it could have broaden your vision as regard to your problem...

If you are looking for opensource java email clients:
http://java-source.net/open-source/mail-clients
You may also want to have a look at Google Wave . With this you will have next generation communication and collboration tool. Please see some awesome videos about google wave on www.youtube.com
http://code.google.com/apis/wave/
http://code.google.com/p/wave-protocol/wiki/Installation
.
Updated solution... Web based email clients
http://java-source.net/open-source/web-mail
http://code.google.com/p/cubusmail/
http://www.zimbra.com/downloads/os-downloads.html

I think a web-based IM client like SparkWeb can be useful in your scenario.

Using XMPP protocol for messaging is recommended because you can easily federate your server with other chat servers, such as GTalk and Jabber.
If you intend to embed the messaging server into your application, Tigase is a fast and reliable Java XMPP server which can be easily integrated because of being lightweight and having no third-party dependencies. It also scales to hundreds of thousands of users almost seamlessly.
For the client, you can use many available web-based XMPP clients such as emite which is a GWT-based web client that is both beautiful and AJAX.

Related

(Java) Real time web application

During my studies, I have to make a project connected with programming in Java. I learn Java from a few months and I would like to make something interesting (not an application for bank, library, car renting etc). I'm wondering whether it is possible to create real-time web game/application, where you can type something and your friend on another laptop see this message and can send you response? (using internet/Bluetooth) If yes, what I should look for to find information about this type of applications?
Yes, creating something like this is definitely possible. It really will just depend on exactly how you want to implement this (it sounds like you're still not sure EXACTLY what you want, as your description is vague).
What I mean by that, is what do you want as your medium? Would you like the two users to be on their laptops and communicating through their web browsers? Or would you rather have a standalone application that accomplishes this? If so, what Operating Systems will you support? Will it have a graphical user interface, or will it run on the command line?
Let's assume that you want to develop a standalone Windows application that allows the users to exchange messages. Keep in mind that doing this gracefully would involve users logging into your system with authentication, a fairly sophisticated GUI, and lots of encryption for privacy reasons. That being said, a very basic implementation of this could probably be as follows:
You'd have an app that runs locally on the users machine, and also some sort of database backend that your app communicates with. I'd recommend using a mySQL database hosted by Amazons RDS (Here's a tutorial that got me using Javas JDBC library to work with an Amazon RDS database - https://www.youtube.com/watch?v=2i4t-SL1VsU).
Rather than worry about a GUI, I'd suggest trying to get your prototype working on the command line. Your app could preform the following steps when booting up:
Ask user to input the word send followed by a message to send messages ("SEND %MESSAGE%"), or "RECEIVE" to receive messages.
If "SEND %MESSAGE%" is input, add message to database
if "RECEIVE" is input, query the database for all message entries and output them to the user.
You can see that this would accomplish a very crude version of what you asked for, and the devil is in the details. I'd suggest building something very simple like this, and then adding functionality by tweaking and improving features one at a time.

Websocket chat implementation

Most of the demos of Websockets I see are of a chatroom application. I was wondering if it was possible to create more of an Instant Message implementation. The difference being that, in a chatroom application, numerous users connect and share messages with everyone, where, in an instant message application, users can connect to other users they choose.
I would like it to work without any plug-ins. I'm using JavaScript for the client side and Java EE for the server side. I looked into being able to change the endpoint URL but it seems that it has to be known at compile time. I also looked into using the Session object in the onMessage method but how would I know the session object of the user I need to send the message to? And I feel that would be a slow method to cycle through all session objects looking for the correct one. So, how could I create an Instant Message like application using WebSockets?
Websockets are for communication between server and client using the HTTP protocol.
They are a particularly fit solution for any cross-language/cross-platform real time streaming/message passing related tasks, because the client(s)/consumers get notified instantly when any new data arrives, without the need of polling**.
The browser implements the client part of the specification.
Most server-side languages have libraries implementing the server part.
If you want basic instant messaging it's as easy as regular chat: you just have to change the list of recipients from everybody in the chat room to the particular client(s) on that conversation.
If you want to build a production grade instant messenger app, you should be aware you don't have to reinvent the wheel: You can built your messenger app on top of any XMPP library or code your own implementation of the protocol. Either way it takes away a good part of the design burden, letting you focus on the GUI or whatever extensions you consider appropriate.
If you are interested on the latter. check out atmosphere (specially, their plugins and extensions) and this article (it's a little bit old, but it's good introductory stuff):
http://jfarcand.wordpress.com/2010/11/08/using-jquery-xmpp-and-atmosphere-to-cluster-your-websocketcomet-application/
(** If you wanted to use RMI instead, for example, you'd need a JVM on both server and client sides or the RMI-IIOP implementation for CORBA support, which is quite cumbersome for simple tasks. There are also some popular alternatives based on Comet, which is more of a set of techniques than a W3C standard: It's a little more difficult to use than websockets and has a few limitations, but has the benefit of working with legacy technology and implementing real time communication without the need of polling, by using HTTP 1.1 persistent connections)

Writing a Java EE User-Interaction Application

I want to add the feature to my Java EE 6-Web-Application (JSF 2.0/EJB 3.1/Hibernate with MySQLDB) that registered users can write messages to each other (e.g. like writing a message on Facebook). I googled around but didn't find a good example. So my question is:
How would you design such a feature?
1) Writing Entity Object with the message to the DB?
2) Using JMS? But wouldn't that be transient?
3) Totally different?
Would be pleased with any kind of input (links, suggestions).
i searched about that before...
if you want to make simple messaging between them, build your own one using database relations
but if you want complex one, so this would a lot of work
-- many people suggest JMS if you want a professional work
but i also recommend Apache ActiveMQ
see the link to Apache ActiveMQ
Facebook uses MQTT (https://www.facebook.com/notes/facebook-engineering/building-facebook-messenger/10150259350998920) ... But they cover mobile platforms also ... You can consider using that.
If you are just targeting at taking inputs from browsers and displaying the messages received on refreshing a page, you can go with database approach.
JMS will work for you, but you need a JMS provider for that.

Trigger functions from another java program

We've got a server app and two stand alone client apps (both with different functionality - one for front office and the other for back office). Everything is written in Java.
What we need right now:
If both apps are running - click on a button in one app -> checks to see if the other app is open and triggers some functionality (display a message, open a frame) on that app
if the other app isn't open -> it should display a message saying so.
Can anyone point me in the right direction to achieve this. The best real life example I can give is: how clicking on the an itunes link in the web browser opens the iTunes application if installed and to the relevant appstore page.
EDIT: Our applications don't deal with websites at all. Everything uses Swing.
There is no "best" way to achieve inter-app communications but there are many ways; the best one will be the one that fits best your environment: network conditions, firewalls, number of calls, synchronous vs asynchronous, etc...
Usually communication is achieved using either:
Remote Procedure Calls: an app basically calls a function/method on the other app and passes arguments. RPC are usually synchronous: the response is sent within the same communication/transaction
Messaging: an app sends messages to the other app which, maybe, replies with other messages. Messaging is usually asynchronous.
The frontier between the two can be pretty blur with some protocols like REST.
In the Java world,
RPC is usually achieved using either
RMI: Java only solution; easy to implement; does not like firwalls much.
SOAP Web services: not Java centric; hard to implement; full of traps; network friendly.
Messaging can be achieved using
JMS: Java only; rather easy to implement but asynchronous; extremely powerful on high loads
JSON/XML HTTP/s Messaging: there are many protocols here from the most secure like AS2 to RNIF, plain XML/Json POST etc... These are network and language agnostic but always require some work to implement.
An hybrid approach is REST which has become very popular due to the benefits of an easy implementation and network friendliness but has the drawbacks of not being very formalized. it is a technology rather than a specification. I would look at documentation around JAX-RS and frameworks like Restlet and Jersey to get you started.
(Edit)
I purposely did not mention developing your own with Java sockets. IO is by definition impure and often multithreaded: IO is very hard to get right. If you really insist going down that route, at least, use the help of a proper framework like Apache Mina or Netty.

Best solution architecture for user notifications in Java/Grails environment?

I am building a community website using Grails and I want to implement user notifications exactly like stackoverflow.com. For instance, user will get notified for new events ('You have new comments', 'one of your favorite has changed'...) either by email or in his mailbox anytime he returns to the website.
I suppose that this is a common problem and I'd like to hear what easy solution do you advice for implementing the back-end in Grails realm. For instance, is Java Message Service a recommended solution for this?
Thank you.
IMHO no. Java Message Service is basically to perform asynchronous or queued operations.
You just need a user messaging system and notification. I'm not aware of any plugin that could do it out of the box.
I suggest you to implement your own Message domain POGO bound to your user model with a markAsRead flag.
If you want to integrate this with email you can use JMS to decouple user navigation and email/sending. This is particularly useful if you have an high traffic website/webapp
Looks like there's a plugin for that which also uses the Grails mail plugin:
http://grails.org/plugin/notifications
http://grails.org/plugin/mail
I have used the http://grails.org/plugin/mail and the background-thread plugin. Not a "perfect" solution, but it leverages the grails eco-system and gets the job done.

Categories

Resources