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.
Related
sorry if my english isn't perfect.
I'm trying to make an app and I need to exchange information between more devices.
I thought that could be a solution connect the devices on a server but I really don't have the idea where start.
What language I need to study to make this? There is a better solution?
This highly depends on what you are trying to achieve in the first place. It would be helpful if you could tell what you are trying to do, but I will still outline some general aspects:
You need to decide, what information is going to be exchanged and how this should happen
What information: Figure out, what exactly needs to be sent and received. Generic text messages? Images? Byte Streams?
How should this be done: Generally spoken, there are two approaches of getting information as a client: Polling and subscribing.
Polling: This approach means to periodically check an endpoint for new data. For example, HTTP uses this way: A web browser or any other client (REST-Client for example) periodically requests information from a HTTP-Server, using a connection just for this single request.
Subscribing / Sync / Notification: In some way or another, the client tells the server that it is interested in the information and wants to get notified when there is something new. The connection is initiated at the beginning and held open for further usage. The benefit of this approach is that changes are received immediately, but on the other hand a permanent connection needs to be maintained.
Things to study
At the beginning, get a good understanding of the TCP/IP Protocol, how Sockets work, how common Protocols do their job (e.g. HTTP, WebSockets)
Take a look at specific Protocols working on top of the basic ones
Tip: REST: Most common WebServices Protocol, providing a common way to exchange stateless data. Uses Polling.
WebSockets: Socket connection using Web Browsers. Commonly used to update information without needing to poll.
There is no specific language to learn for connections. It's more about understanding what the difficulties are and what ways have been invented to address this. Once you get to this point and know what you want to do, it's possible in every language.
Recommendation: As you seem to use Java/Android, I would try to use REST. A really great client-side library for REST on Android is Retrofit. For the server side use what fits for you .. common Java way would be to use Jersey, but you are free to choose from a lot of choices. If using Jersey is too hard for the beginning, maybe take a look at the JS/NodeJS world, those guys invented Express, which allows you to create a REST service out of just a database, wihtout having to code a lot.
First you need to decide if you want to go for an Android or an iOS application. There are other various mobile operating systems as well, but these are widely used . If you want to go for android which is most widely used in my opinion, then you need to learn Java. If you want to go for iOS application, then you need to learn swift or objectiveC. These languages provide the API to connect with various types of services such as Facebook, Firebase and Amazon etc. If you want to connect to some other local server who’s IP is known to you, then you can use socket programming to send messages.
There could be many ways you can implement this. One way will be using Web services. Of course REST might be a better option, if you follow this approach. You can implement Your service(server side code) with any language. I will recommend you use java since you are already using android.
Aside from this You might need to go through the basics of REST, its specifications and
some reference implementations for language of your preference.
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.
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.
Is it possible to receive object content change events from an LDAP server? Basically, I'm searching for a solution to integrate light weight directory services with our software via JNDI to setup active directory synchronization. (i.e. I'd like for the consumer application to be notified when a new entry is made or an object state has changed)
Below are a few possibilities I've came up with so far:
Enable auditing policy on directory objects and register a listener to read incoming changes from the change log.
Implement persistent search against the directory.
Mechanism to poll the directory for changes.
Could someone with more intimate knowledge of LDAP care recommending an optimal approach to a novice person like me?
Thanks in advance!
I'm not an ultimate expert on the topic, but I've had very similar requirements in my previous project, and made a thorough research on possible ways to implement synchronization from Active Directory. As far as I know, there is no other solution than the three options you listed above.
I think the third option is the most viable in most of the cases. It's not very difficult to implement the polling logic yourself, but you might be interested in a small java library that already does most of the hard work. It can help you getting started with change tracking in Active Directory very quickly.
Check it out here: https://github.com/zagyi/adsync4j
Disclaimer: I'm the author of the library and would love to get some feedback if you end up making use of it.
Your best bet with Microsoft Active Directory is to implement the DirSync Control.
Not sure of code in JNDI to implement DirSync Control but I know there is an implementation with UNBOUNDID LDAP SDK.
-jim
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.