I'm about to embark upon writing an android app which notifies the phone's user when an external mySQL DB is updated (add only) with a ticket so that the user can check if the ticket requires his attention (an attempt to reduce the buildup of tickets that he has to trawl through).
From my research, most questions suggest using a PHP web service with my program (written in java) and definitely/maybe/definitely not/it's deprecated using SQLNotification to fire the event. I've also seen something about some bloke called JSON and the brands of SOAP he uses.
What I've been unable to figure out is how all of these frameworks/toolkits/services/things work together.
My question is in two parts:
Is SQLNotification usable? If not, is there a simple way to check for changes (beyond the obvious answer of polling)
How does everything (SOAP, JSON, web service, app) fit together and have I missed anything on the frameworks front (Heard mentions of spring, hibernate, tomcat).
On my experience, I'm relatively fluent in Java, understand the basics of MySQL, am a beginner in PHP and haven't written for android before.
Thanks,
Ben
According to the information you have provided, seems like you have different options:
Push
If you want to go the push way, you will need some central architecture that can take notifications from the database and immediately send them to connected clients. It's not that easy to build such a scheme, would only recommend it if you really need immediate notification. As a start point, look at this sample: http://www.gianlucaguarini.com/blog/push-notification-server-streaming-on-a-mysql-database/
Pull
If you go the pull way (polling), you can have a service working on the phone wich polls every configured time. In that case you will need some stateless service, some simple JSON service would do great.
On both cases, be careful with security, you should secure your channel with ssl and have some decent sort of authentication.
I think a good rule of thumb is saying (it's just based on personal opinion/experience, maybe your decision path has other factors that you have to consider), if your pollig intervals don't need to be lower than 5 minutes, polling will do fine. If you need almost real-time notifications, you can implement the push architecture, but you have to know it will cost more efford to get it working as you have to take care of things like client disconnection, how to handle notifications if a client is not connected, get the real-time notifications from the database, etc.
Hope this helps as a starting point,
Related
I have a situation where an application has a list of values, for example, a list of books, that changes from time to time. It also has a REST endpoint where this information is published.
There are several other applications that consume this information, and they should be aware if any of the books on my application changes.
Would the reactive style be adequate to this situation? At first, I thought so, based on the Observer pattern. But would this be a good approach, considering the applications involved only exchange information based on web services?
I also looked at retrofit, that could transform the endpoints, into java interfaces. But all the examples I found, were somehow related to android applications.
So, would this approach be advisable in this scenario? If it is, can someone recommend a book, or any kind of resource?
EDIT:
Since I will have an endpoint that publishes books, should I turn it in to an Observable, that when gets another book available, notifies all the subscribers of this event, and that would in turn decide if they should or not do something?
If so, how would a client, it can be for example, and angularjs app or another java application, subscribe to this observable?
I hope I could make myself a little bit more clear.
I think you are mixing up the Rx programming with a network problem. If your server sends data over the network at X interval of time then as #TheCoder said you can listen for changes on a socket and trigger an event on your rx stream with the help of a PublishSubject. But I think that the real issue lies in the way your data are sent by your server.
If you have to query your server to know if your list of books has been updated it is not very effective to trigger such calls when your goal is to have a real time update. In these type of scenario a Publish-Subscribe pattern is more appropriated where your client just act a receiver and can update itself as soon as your server push new values (a new list of book in your case). You can find tools like pubnub or the MQTT protocol to achieve such things.
For you to understand quickly how this system works you can look at this.
I have developed a few apps in my days, but only small local applications.
I want to start working on more advanced apps, and I have a few ideas that require me to keep track of usernames, scores etc, Online.
Lets say im looking for a way to keep track of usernames/passwords, making sure the usernames are unique, and updating the client sqlite database aswell as server database whenever they go online.
So far the only ways I can think of is creating a java servlet or posting and recieving data through PHP and into a MYSQL database. (which I have done some testing on... and I dont really like it).
What is the common/best way to do this? Can anyone nudge me in the right direction?
Essentially what you need is a web service hosted somewhere to perform the tasks you need, such as ensuring unique usernames etc.
I would suggest creating a REST service for this, perhaps look into JAX-RS for this, but any REST framework would suit you.
On the Android front, you would need a (de)serializer, such as Google's GSON which will enable you to convert Java objects to/from JSON seamlessly.
Finally, something like Square's RetroFit will make it much easier to call on that external REST api from your Android code.
These are just a few of the possibilities - there are alternatives to all of these libraries if you don't like any of them.
I am writing a remote Lotus/Domino NSCO (Notes CORBA API) Java client for reading and writing to a Domino server. The client should roughly be able to act and simulate all the features of Lotus Notes desktop client for a user's mailbox (Mail, Calendar, Tasks).
Those of you experienced with NSCO.jar are probably already aware of many limitations it has. One example is marking a document as read/unread, which isn't implemented with this API. To bypass this, my latest direction is writing a Java Agent on the server side, which would use Java Notes local API to mark a document as read/unread. I can later call this client using the NSCO API. I would like to be able to call this agent for every user (every user has his own database), but I dont like the idea of creating an instance of this agent on each database. According to this, my question is:
- How (if possible) can I register an Agent in Domino so that is available for every user?
Apart from this specific question, I would very much appreciate any links towards good documentation or books on this topic. (I believe I have already browsed through most of online documentation, and it's quite poor or out-of-date so books might be more useful)
Thanks.
Your question is very broad but I will attempt to answer what I can.
First, I don't think you realise the huge task you are attempting to do in simulating the Notes Client.
Much of the functionality in the front end will not be available for you, and creating back end agents to get to that functionality is going to put undue stress on the server. You are going to have to do some serious load testing to see what impact it has.
How (if possible) can I register an Agent in Domino so that is available for every user?
The proper way is to create the agent once in a template and then have the mail files update their design (Admin related help). The agent is then run within each users mail file as they need it. You also need to factor in how the agent runs. For example if you run it scheduled then AMGR may not run it as you expect it to.
If you plan to have one agent you kick off to process all databases, then you start having to deal with security of your agent.
Alternatively you can go the route of DOTS tasklets. These are OSGi bundles which can run like a service on the server.
I would very much appreciate any links towards good documentation or books on this topic.
The help within the Domino Designer client will be the most up to date on the API. The Domino Wiki will have a lot of resource material you are looking for.
Personally I think what you are attempting to achieve with just NCSO is not going to cut it. I would recommend to leverage already existing standards to talk to the server. For example POP3/SMTP/ICAL/RnR/DDS (REST API). Or use iNotes which would have much less overhead then what you are trying to achieve.
I'm trying to set up a message queue service for an application I am developing.
I already tried AWS SQS, but it doesn't really fit for our needs, mainly for the issues with the FIFO and the limited message persistence.
So I turned to IronMQ, to see how this could work, but I'm already having issues with the creation of users via java APIs.
There's no class dedicated and it seems nobody cares about that. Does anybody know anything about how to do that? Do I have to write my own APIs?
EDIT: as manveru pointed out, I'm talking about tokens, not users.
Another issue is about setting other permissions than "Admin", but I guess I'll confront it later.
Right now, our API doesn't support creating new access tokens. I think it's something that could be really powerful, though (generate a token per server as part of the build process, for example).
I've created an issue in our global issue tracker. If you like, you can follow that to get a notification when something on this front changes. We have a lot of stuff we're working on right now, so I can't even guess at a timeline, unfortunately. :(
Hope that helps!
I am creating a website where users will be able to chat and send files to one another through a browser. I am using GWT for the UI and hibernate with gilead to connect to a mysql database backend.
What would be the best strategy to use so Users can interact together?
I'd say you are looking for comet/AJAX|Server push/etc. See my previous answer on this matter for some pointers. Basically you are simulating inverting the communication between server and client - it's the server that's initiating the connection here, since it wants to, for example, inform the user that his/her friend just went online, etc.
The implementations of this technique change quite rapidly, so I won't make any definitive recommendations - choose the one that best suits your needs :)
COMET is the technology that allows chatting over a web page - It is basically communicating through keep-alive connections. This allows servers to push information to the client.
There are several implementations of this on the client side with GWT.
Most servers nowadays support this, It is also part of the Servlet 3.0 spec (Which nobody has implemented yet)
While COMET is very nice, it's not the only solution! Usual polling with time intervals (as opposed to COMET long polling) is still commonly used. It's also possible to require a manual refresh by the user.
Take Stackoverflow as an example - for most things you must refresh your browser manually to see the changes. I think, it's commonly perceived as normal and expected. COMET or frequent polling are an added bonus.
The problem with COMET is, that it can easily lead to lots of threads on the server. Except, if you additionally use asynchronous processing (also called "Advanced IO"), which is not too well supported yet (e.g. doesn't work with HTTPS in Glassfish v3 due to a severe bug), can lead to problems with Apache connectors etc.
The problem with frequent polling is, that it creates additional traffic. So, it's often necessary to make the polling less frequent, which will make it less convenient for the end user.
So you will have to weigh the options for your particular situation.