issue in sending push notification using push queue.
GoogleCodeExporter opened this issue · 2 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
1.Use push queue with 5 thread, the code is
int threads = 5;
PushQueue queue;
public void init(){
queue = Push.queue("//APNS_Production_Certificates.p12", apnspassword, true, threads);
new Thread() {
public void run() {
queue.start();
}
}.start();
}
2. when send message,use the code
public void sendNotification(String deviceId,String message){
PushNotificationPayload payload = PushNotificationPayload.alert(message);
try{
queue.add(payload, deviceId);
}catch(InvalidDeviceTokenFormatException invalidDeviceexception){
Logger.serviceLog.warn(MODULE + "Exception in sending message to IOS Server:" + invalidDeviceexception, invalidDeviceexception);
}
}
3.every time it work but every time it sent on second attempt.
What is the expected output? What do you see instead?
1. As I am using queue and in init method I am starting queue so in init method
it show logs
Initialized Connection to Host: [gateway.push.apple.com] Port: [2195]:
17e8fb6[SSL_NULL_WITH_NULL_NULL:
Socket[addr=gateway.push.apple.com/17.172.232.30,port=2195,localport=3610]]
this means connection is already established.
but when I call the sendNotification(deviceId) method i.e. whenever
queue.add(payload, deviceId); this line executed
it show below logs every time
156842 [JavaPNS grouped notification thread in QUEUE mode] INFO
javapns.notification.PushNotificationManager null - Attempt failed (Remote host
closed connection during handshake)... trying again
Creating SSLSocket to gateway.push.apple.com:2195
Attempting to send notification: {"aps":{"alert":"hi cool"}}
157217 [JavaPNS grouped notification thread in QUEUE mode] DEBUG
javapns.notification.PushNotificationManager null -
to device: 250f90866e2b4e9fc6e618e62fd331818f41cacef16379554246c3483baa5872
158092 [JavaPNS grouped notification thread in QUEUE mode] DEBUG
javapns.notification.PushNotificationManager null - Flushing
158092 [JavaPNS grouped notification thread in QUEUE mode] DEBUG
javapns.notification.PushNotificationManager null - At this point, the entire
142-bytes message has been streamed out successfully through the SSL connection
158092 [JavaPNS grouped notification thread in QUEUE mode] DEBUG
javapns.notification.PushNotificationManager null - Notification sent on second
attempt
So My question is why I am getting "Remote host closed connection during
handshake" every time I send notification. As it is establishing connection in
init() method. every time it send notification on second attempt.
What version of the product are you using? On what operating system?
javapns 2.2 ,Java Web Application , Linux
Please provide any additional information below.
I think the queue mechanism is not working properly. So suggest me the best way
to use queue or any other mechanism.I want to use the solution for production
environment. if it create connection every time then its waste of time and loss
of TPS.
Please suggest me the root cause. please find attached log file.
Original issue reported on code.google.com by hareshap...@gmail.com
on 17 Sep 2014 at 6:39
Attachments:
- [queue log ios.txt](https://storage.googleapis.com/google-code-attachments/javapns/issue-217/comment-0/queue log ios.txt)
GoogleCodeExporter commented
Can you please guide me.
Original comment by hareshap...@gmail.com
on 22 Sep 2014 at 8:01
GoogleCodeExporter commented
How much time passes between the time you started the queue and the time you
send your notification? Is it possible that your connection to APNS simply
closed because it remained to long without activity, probably from Apple's side?
Original comment by sype...@gmail.com
on 11 Dec 2014 at 5:09