In my Java client application, I have a web service call which communicates with a server application using MQ/ESB to update data.
Sometime it happens MQ/ESB is down and the data does not update from one application to another, as MQ/ESB is a channel between the client and server applications.
Is there a site or tool which periodically hits the web service url and reports an error via email when it goes down?
You can use a custom script that fires a curl request periodically and email it based on the response. A simple java program hitting the web service in a loop can also help.
There are monitoring tools like nagios that can be configured and used for this purpose.
Using FreeSiteStatus.com Web-based control panel, enter the URL you wish to monitor (e.g. http://www.yourdomain.com), and select the monitoring interval (e.g. 1 minute). The monitoring interval represents how often we’ll check to see if the website is online and responding properly. The smaller the interval, the more frequently we’ll check your website.
Next, add email, SMS and push contacts to be alerted on outages. We’ll send an email or text message to these contacts any time there is an outage with your URL, so you’ll know instantly if your website goes down.
Features
1. 24 x 7 x 365 Non-Stop Monitoring
2. Worldwide Monitoring
3. Downtime Notification
4. Send Reboot Request to Your Provider during Downtime
5. Multi-Protocol Support
6. Uptime & Performance Reports
7. Push(SMS) Notification
Related
Is it feasible to have Ionic 3 react to server-side events fired from a Tomcat App, to update a model in real time. And make sure events fired from server are received in the order sent.
At it's simplest, if the server sent a notification with a random number that the Ionic App could refresh as it receives notifications. And maybe some sort of sequence number in the payload that the client also keeps track of.
If so, could someone post an example. Thanks.
Also, if the client misses notifications, you'd probably have to re-pull the whole model, what techniques would people normally keep the app up to date, accurate, robust, and responsive.
Maybe I'm overthinking this but I'd like some advice. Customers can place an order inside my GWT application and on a secondary computer I want to monitor those submittals inside th eGWT application and flash an alarm every time an order is submitted, provided the user has OK'd this. I cant figure out the best way to do this. Orders are submitted to a mysql database if that makes any difference. Does anyone have a suggestion on what to do or try?
There are two options: 1) polling or 2) pushing which would allow your server (in the servlet handling the GWT request) to notify you (after the order is successfully placed).
In 1) polling, the client (meaning the browser you are using to monitor the app) will periodically call the server to see if there is data waiting. It may be more resource intensive as many calls are made for infrequent data. It may also be slower due to the delay between calls. If only your monitoring client is calling though it wouldn't be so resource intensive.
In 2) pushing, the client will make a request and the request will be held open until there is data. It is less resource intensive and can be faster. Once data is returned, the client sends another request (this is long polling). Alternatively, streaming is an option where the server doesn't sent a complete request and just keeps sending data. This streaming option requires a specific client-/browser-specific implementation though. If it's just you monitoring though, you should know the client and could set it up specifically for that.
See the demo project in GWT Event Service
Here is the documentation (user manual) for it.
Also see GWT Server Push FAQ
There are other ways of doing it other than GWT Event Service of course. Just google "GWT server push" and you'll find comet, DWR, etc., and if you are using Google's App Engine the Channel API
when building a server, one sometimes performs asynchronous tasks from client to server (which responds to client in asynchronous time),
or the server needs to send the client a message
now if the client is listening at all times (meaning polling) it takes a lot of resources which is problematic
here is where I assume the operating system steps in and assumes the role of polling for the appropriate port, and letting the application know using the appropriate event (the application subscribes using the OS API)
am I right in my assumptions?
how do I subscribe to a port using the OS's API? (lets say android for the sake of argument)
how is a message from server to client work exactly?
and how does the server know the client's IP at all times?
I have seen many questions in the subject, but wasn't able to figure out the big picture
Edit:
I am using GCM in android, but have seen other apps that does not use it and still manage to do it right, also it's a more general question as to what is the right approach in java VS. any operating system it uses (ubnutu, windows, android, etc.)
Totally right - polling is typically a waste of resources. Until recently, many apps would either keep a socket open and poll every few minutes to keep it alive, or make periodic HTTP calls to a server.
Nowadays, Google Cloud Messaging is used by most apps to push data instead of constantly polling. As you correctly guessed, this is implemented by maintaining a persistent connection with Google's servers. The advantage of this is that it's very efficient for battery life, and that all apps can use this one resource to send push notifications, instead of each app having to poll a different server or create its own persistent connection.
The idea is that you send requests to GCM from your server (this can be in response to user activity, etc), which sends it to all of the client's devices. You can either send a message with a small payload (up to 4kb) or a "send-to-sync" message, which tells an app to contact the server (e.g. to sync new data from the server after user changes).
here is where I assume the operating system steps in and assumes the role of polling for the appropriate port, and letting the application know using the appropriate event (the application subscribes using the OS API)
GCM pushes messages to clients, so there isn't active waiting like you'd see in a simple polling system.
how is a message from server to client work exactly? and how does the server know the client's IP at all times?
There's no need for servers to know the client IP, as any online android device will typically maintain a connection with GCM. Targeting specific users is done via User Notifications.
(Oh, and I realize that your question is more general than just Android, which I have more experience in, but iOS has a similar system in place. Some developers I've met like to use Parse for managing push notifications).
I am an experienced application developer who now has to develop a web application which I don't have a lot of experience in.
I am working on a project that has a number of distributed server components. It currently has a client application that monitors these components, view alarms and logs etc. The state of each of the server machines is delivered via a proprietary protocol over tcp/ip.
The current UI based app has a thread that continually monitors the socket connection for messages and once received stores in-memory the current state of everything and then displays this to the user.
My question is how do I achieve something similar in a web application environment. My first thought was to create a similar comms thread on server start and then when the user requests data the response is built up from the in-memory data but reading about web applications starting your own threads is bad practise.
I have read a little about using Quartz or TimerTask to run periodic schedule tasks in web applications but this task is more continuous. Is it still the way to go?
I'm developing the web app in Java using JSF running Tomcat on Linux. Oh and the application will have a low number of concurrent users. (25 max but more likely 2 or 3)
Approach 1
Using Quartz is good. It is advised not to use TimerTask.
Approach 2
I am assuming that the web application has some sort of database. Since you need to display the states on user request, not real time what you can do is that write a standalone daemon application (not a web application) which reads for server states and updates a table which is visible to the web application. When the user request is made this table can be referred to produce output.
Why make this a server concern? In your client (the browser) you can poll the current state and adjust the display according. Doing this removes a lot of complexity.
As to how your client will be updating, that's dependent on your app. If you can allow for only modern browsers, you could look into HTML5 WebSockets. Other options are using AJAX for partial update of the screen or a complete screen refresh.
If I am developing an Android application, what is the most feasible way to get near real-time notifications about an incoming email? Is there a push-like mechanism, or can I hold my IMAP connection for a long time, or do I use IDLE command?
Consider that user is authorized to use GMail services via OAuth and I don't want to poll IMAP server madly.
Update:
I'm not using the phone's configured-in Google account. There is another account set up using OAuth.
I'm using Apache Commons Net to connect to IMAP/SMTP in my app. It's a bare-bone library for IMAP, but I can perhaps modify it to add IMAP commands/extensions.
You can register a ContentObserver with GMail, anytime something changes in GMail, the observer will be called.
contentResolver.registerContentObserver(Uri.parse("content://gmail-ls"), true, myContentObserver );
Override onChange in your ContentObserver to do stuff when something in GMail changes.
Since IMAP does natively provide any sort of push notifications and the Google extensions don't either, you have to implement it yourself.
One way is to use IDLE requests, which is still a cheap way to do polling. Of course, you can't expect your app to be running all the time, so you need to use a background service. An 'always-on' service is however an anti-pattern on Android and will drain the battery quickly and likely get you many 1-stars. Additionally the system may decide to kill it at any time. The other alternative is to use AlarmManager to start the service periodically, but starting it every couple of seconds or so is just as bad. So you are basically back to square one: polling.
The other way is to get push notifications using GCM or a similar service. This does require you to have a server, and the server needs to have the authentication info for the user (which might be a problem), but there are no real constraints concerning keeping open connections and sending IDLEs each second, etc. On the Android side, if you want to implement push yourself, you need to keep an open socket to get notifications. This is not very easy to do if you are not a system app (see above), so that leaves GCM. The connection it uses is manged by the system (Google Services framework), it can do things a regular app cannot, and you basically get it for free, since it's already there. It receives small pieces of data when there is something to do, called 'tickles'. Those in turn trigger broadcasts, Google Play updates, etc.
So, take your pick. Or just give up, register the account and use GMail and its labels Android API.
I'd check out Google Cloud Messaging (GCM):
http://developer.android.com/training/cloudsync/gcm.html
My understanding is that this works without requiring the user's Google account, and lets you handle authentication.
See a tutorial here:
http://www.techrepublic.com/blog/app-builder/implementing-googles-cloud-to-device-messaging/428
You would need additional server-side code running to do this though.