Using JMS in RESTFull Web services - java

I am developing the Rest Full services in Java+Spring, that can be used by Mobile Apps(iPhone+Android) and on Web Applications.
Would it be better choice to choose JMS(Java Messasing service) for Sending asynchronous and Reliable Email messages to Mobile Apps and Web application or is there any better alternative other than JMS for asynchronous messaging. Please help.
EDIT :
I want my RESTFull web services to send email messages that not only provide the guarantee of delivery of the Email messages but also use the asyancronous messaging mode so that server would not be waiting for reciever to recieve the message. Also please suggest if i use JMS at server end to Publish/Produce the messages in a Queue, how will the Mobile Apps will recieve the messages from the JMS Queue? Is it possible for IPhone/Android/PHP web application to recieve the message that was published by JAVA server.
Thanks,
Arun Kumar

JMS isn't appropriate for mobile applications. Mobile applications can't be expected to be always running and listening for connections. For these reasons Push Notifications are used for sending messages to mobile devices. Both Apple and Google offer this kind of services.

Related

Is it possible to send Upstream Message with Java?

I have my own app server which communicate with FCM server. And I have Android/iOS mobile apps working well.
I want to set a third party program using Java which send a message to FCM server repeatedly so I can keep tracking my own app server is working fine.
I tried to find a solution but official website mention about upstream message only with Android/iOS app.
Is it possible to send a upstream message to FCM server using Java?
(Or any other good idea to monitor the server? I faced the server sometimes goes down for some reason without notice it :( )
There is currently no way to send upstream messaging other than what is shown in the docs -- currently available for Android and iOS.
Even if you are able to send an upstream message, it wouldn't make sense. The flow of upstream messaging is:
Client App > FCM Server > App Server
So the result/response that you would get when sending a message, should it succeed/fail, will point out the communication between the FCM server and the Client App, not with the App Server.

How to receive sms in a web application in java ?

i'm trying to create a web application that sends and receive SMS. I've already contacted a local SMS gateway and the connection is working.
I'm using Jsmpp as the library and i'm able to send and receive SMS through a sample application i build using Java SE.
Now i need to migrate this feature to web application. Sending SMS should be ok. But how can i add a listener to listen to the SMSC through my web application ? I'm using Spring and j2ee.
The SMSC doesnt expose a web api and dont have the ability to send sms to a api i expose. The only way they allow is the communicate through the SMPP protocol.
Thanks In Advance.
did you try the program in the link - http://www.java-samples.com/showtutorial.php?tutorialid=22?
If you are looking for any Bulk SMS Solution, You can use APIs provided by vendors such as https://www.textlocal.in/ or any other vendor whichever is feasible.
If you are looking to setup a gateway for yourself, you can check a solution like http://www.ozekisms.com/
Earlier there were Network Vendor provided Gateway which you can freely use, now there are no such gateway you can use freely.
More links,
https://www.quora.com/How-can-I-send-a-SMS-with-a-Java-code
http://www.airtel.in/aes/Global+Business/Global+Voice/Enterprise+Voice+Solutions/Mobility+Solutions/Enterprise+VAS/Bulk+SMS+Solutions
After lots of trial and error i managed to find a solution for the question.
The way i implemented it was to run a standalone java application as a Linux service that would listen to the SMSC. I used the sample project SMSRouter (https://smsrouter.org/) as the basis. Apache camel smpp component was used in this sample project to handle sms sending and receiving.
I then created queues inside Jboss application server for inbox and outbox to store incoming and outgoing sms messages.
Once a SMS is received by SMSRouter it will use JMS to add the SMS message to the inbox queue inside Jboss which will trigger a Message Driven bean that would keep listening to the inbox queue.
When the Web Application needs to send a SMS it will add a JMS message to the outbox queue which will then trigger the SMSRouter which is listening to the outbox queue. SMSRouter will use Apache Camel to send the SMS to the SMSC.

Retrieve last sent messages from xmpp servers after disconnect

I have created an IM app that uses asmack to connect to various xmpp protocols such as google talk and facebook.
Occasionally some messages are lost in transit (both sent and received messages) when switching between Wifi/Data or when you lose signal altogether. Is there any way to retrieve the last received messages for that particular protocol when the app manages to reconnect? I find myself having to constantly check the default messaging app to see if any messages came through while I was disconnected.
Also, how about a way to get obtain delivery confirmation upon sending a message?
Thanks!
If you use a server that supports XEP-0136: Message Archiving or XEP-0313: Message Archive Management, you'll be able to obtain all messages previously sent.
However, neither Google Talk nor Facebook Chat implements these, and afaik they have no alternative XMPP API for it either.

Hosting an Application Server on App Engine?

I'm wondering if it is possible to host an Application Server on Google App Engine, I'm not planning to host a Web Application, but yes an App Server.
For example, hosting a Chat Server, that would Authenticate users log ins, register new users, establish a connection between two users running on clients developed to work with that Server.
If not, is there a similar service to GAE which I can use for that purpose.
Thanks a lot.
The XMPP and Channel APIs should let yo do it. If your client can make HTTP requests and your server can respond to them, then yes, you should be able to do it.
Yes this is possible.
Have a look at the Google Docs for an introduction to what the platform looks like and what APIs are available. And crucially what restrictions there are. For chat applications you might be interested in the Channel API.

How to implement Beluga or WhatsApp like messaging system in Android 2.1

I am trying to develop a message app within my android app. The message will be like whatsapp and beluga. I googled it and found C2DM Android 2.2 can send the push notifications to the device. However, this is not available on Android 2.1. Anyone knows how whatsapp send the notifications for 2.1 devices?
For Android: Whatsapp is build upon C2DM and when the app opens it opens an XMPP connection to their service to deliver the messages instantly. They also might use MQTT as a protocol to minimize battery usage. That's basically it.
Edit: I learned more, Facebook uses MQTT in their messaging app. Whatsapp is build upon XMPP with their own extensions. Their server side runs on top of ejabbard (XMPP implementation in erlang). http://www.ejabberd.im/
On pre 2.1 devices WhatsApp probably keeps a connection open to their XMPP servers in the background but this is not really good for battery life.
C2DM is replaced by GCM (google cloud messaging) now . you can use it for delivering the notifications to your app . For the exchange of message one should rely on protocols like xmpp (whatsapp), mqtt(facebook messenger), mtproto (telegram) etc.
if you are looking to familiarize yourself with GCM . try out this tutorial by appsrox - Create an Instant Messaging app using Google Cloud Messaging (GCM)
they are using GCM for the message delivery as well. it won't suit for production, but its an excellent resource for people who want to develop an instant messaging android app .
I don't know what exact technology is used in whatsapp. However, if i am to implement notifications where there is no support for push notifications from the OS, i can do two things:
Poll a remote server every X seconds and check for new notifications (this is the more expensive choice).
Run a background service, maintain a connection with a remote server, which will pump me any notifications that are to be received (sort of my like my own push notification implementation).

Categories

Resources