Package org.jboss.aerogear.simplepush.protocol.impl

Examples of org.jboss.aerogear.simplepush.protocol.impl.NotificationMessageImpl


                    if (unacked.isEmpty()) {
                        logger.info("Nothing to ack. Stopping periodic task");
                        vertx.cancelTimer(timerID);
                    } else {
                        logger.info("Resending " + unacked);
                        final Buffer buf = new Buffer(toJson(new NotificationMessageImpl(unacked)));
                        vertx.eventBus().send(writeHandlerMap.get(uaid.toString()), buf);
                    }
                }
            });
        }
View Full Code Here


                try {
                    final String endpointToken = request.params().get("endpoint");
                    final String payload = buffer.toString();
                    logger.info("Notification endpointToken  [" + endpointToken + "] " + payload);
                    final Notification notification = simplePushServer.handleNotification(endpointToken, payload);
                    final NotificationMessage notificationMessage = new NotificationMessageImpl(notification.ack());
                    vertx.eventBus().send(writeHandlerMap.get(notification.uaid()), new Buffer(toJson(notificationMessage)));
                    request.response().setStatusCode(200);
                    request.response().end();
                } catch (final Exception e) {
                    logger.error(e);
View Full Code Here

                    final JsonNode versionNode = channelNode.get(NotificationMessage.VERSION_FIELD);
                    final JsonNode channelIdNode = channelNode.get(RegisterMessage.CHANNEL_ID_FIELD);
                    acks.add(new AckImpl(channelIdNode.asText(), versionNode.asLong()));
                }
            }
            return new NotificationMessageImpl(acks);
        }
View Full Code Here

            ackJobFuture = session.getContext().executor().scheduleAtFixedRate(new Runnable() {
                @Override
                public void run() {
                    final Set<Ack> unacked = simplePushServer.getUnacknowledged(uaid);
                    logger.info("Resending " + unacked);
                    session.send(toJson(new NotificationMessageImpl(unacked)));
                }
            },
                    delay,
                    simplePushServer.config().acknowledmentInterval(),
                    TimeUnit.MILLISECONDS);
View Full Code Here

                final Notification notification = simplePushServer.handleNotification(endpoint, payload.toString(UTF_8));
                final String uaid = notification.uaid();
                final SockJsSessionContext session = userAgents.get(uaid).context();
                if (logger.isDebugEnabled()) {
                    logger.debug("Sending notification for UAID [ " + notification.uaid() + "] " +
                            toJson(new NotificationMessageImpl(notification.ack())));
                }
                session.send(toJson(new NotificationMessageImpl(notification.ack())));
                userAgents.updateAccessedTime(uaid);
            } catch (final ChannelNotFoundException e) {
                logger.debug("Could not find channel for [" + endpoint + "]");
            } catch (final VersionException e) {
                logger.debug(e.getMessage());
View Full Code Here

        final Object out = channel.readOutbound();
        if (out == null) {
            return Collections.emptySet();
        }

        final NotificationMessageImpl unacked = responseToType(out, NotificationMessageImpl.class);
        return unacked.getAcks();
    }
View Full Code Here

            final String str = channel.readOutbound();
            if (str == null) {
                Thread.sleep(200);
            } else {
                // The notification destined for the connected channel
                final NotificationMessageImpl notification = responseToType(str, NotificationMessageImpl.class);
                assertThat(notification.getMessageType(), is(MessageType.Type.NOTIFICATION));
                assertThat(notification.getAcks().size(), is(1));
                assertThat(notification.getAcks().iterator().next().getChannelId(), equalTo(channelId));
                if (version != null) {
                    assertThat(notification.getAcks().iterator().next().getVersion(), equalTo(version));
                } else {
                    final Date date = new Date(notification.getAcks().iterator().next().getVersion());
                    assertThat(date, is(notNullValue()));
                }
                countDownLatch.countDown();
            }
        }
View Full Code Here

                assertNotNull(ack.getVersion());
                messageLatch.countDown();
            }
        });

        client.getWebsocketClient().sendText(JsonUtil.toJson(new NotificationMessageImpl(new AckImpl(UUIDUtil.newUAID(), 1))));

        //wait for the communication to happen
        messageLatch.await(1000, TimeUnit.MILLISECONDS);

        //then
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.simplepush.protocol.impl.NotificationMessageImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.