Examples of ChannelMessage


Examples of com.google.appengine.api.channel.ChannelMessage

    // And the other has the same friend
    oam.addFriend(action.getEmail(), user.getEmail());
   
    String json = toJson.getJson(null, user.getEmail(), MessageType.addContact);
    ChannelService channelService = ChannelServiceFactory.getChannelService();
    channelService.sendMessage(new ChannelMessage(action.getEmail(), json));
    return new AddFriendResult(result);
  }
View Full Code Here

Examples of com.google.appengine.api.channel.ChannelMessage

    String encodedMessage = encodeMessage(msg);
    for (String userUniqueId : userUniqueIds) {
      String key = getAppKeyForUser(userUniqueId);
      logger.info("Pushing msg to " + key);
      try {
        getChannelService().sendMessage(new ChannelMessage(key, encodedMessage));
      } catch (Exception e) {
        // [The original google example code notes here:
        // A bug in the dev_appserver causes an exception to be
        // thrown when no users are connected yet.]
        logger.log(Level.SEVERE, "Failed to push the message " + msg + " to client " + key, e);
View Full Code Here

Examples of com.google.appengine.api.channel.ChannelMessage

              return false;
            }
          });

      ChannelServiceFactory.getChannelService().sendMessage(
          new ChannelMessage(channel, serialized));
    } catch (SecurityException e) {
      e.printStackTrace();
    } catch (NoSuchMethodException e) {
      e.printStackTrace();
    } catch (SerializationException e) {
View Full Code Here

Examples of com.google.appengine.api.channel.ChannelMessage

    } else {
      // send msg
      ChannelService channelService = ChannelServiceFactory.getChannelService();
      logger.info("sending msg : client id = " + clientId);
      logger.info("sending msg size = " + msg.length());
      channelService.sendMessage(new ChannelMessage(clientId, msg))
    }
  }
View Full Code Here

Examples of com.google.appengine.api.channel.ChannelMessage

      Util.jsonPut(matchMsg, "object", matchedObject);
      Util.jsonPut(matchMsg, "queryIds", new JSONArray(queryIds));
      logger.fine("MatchResponseServlet: delivering json: " + matchMsg);

      ChannelServiceFactory.getChannelService()
          .sendMessage(new ChannelMessage(endpointId, "(" + matchMsg + ")"));
    }
  }
View Full Code Here

Examples of eu.mosaic_cloud.components.core.ChannelMessage

    Assert.assertTrue (channelController.bind (channelCallbacksProxy).await (BasicChannelTest.defaultPollTimeout));
    final QueueingChannelCallbacks channelCallbacks = QueueingChannelCallbacks.create (channelController, exceptions);
    final CallbackIsolate channelCallbacksIsolate = reactor.createIsolate ();
    Assert.assertTrue (reactor.assignHandler (channelCallbacksProxy, channelCallbacks, channelCallbacksIsolate).await (BasicChannelTest.defaultPollTimeout));
    for (int index = 0; index < BasicChannelTest.defaultTries; index++) {
      final ChannelMessage outboundMessage = RandomMessageGenerator.defaultInstance.generateChannelMessage ();
      Assert.assertTrue (channelController.send (outboundMessage).await (BasicChannelTest.defaultPollTimeout));
      final ChannelMessage inboundMessage = channelCallbacks.queue.poll (BasicChannelTest.defaultPollTimeout, TimeUnit.MILLISECONDS);
      Assert.assertNotNull (inboundMessage);
      Assert.assertEquals (outboundMessage.metaData, inboundMessage.metaData);
      Assert.assertEquals (outboundMessage.data, inboundMessage.data);
    }
    pipe.sink ().close ();
View Full Code Here

Examples of org.apache.catalina.tribes.ChannelMessage

         */
        protected void pushQueuedMessages(LinkObject entry) {
            do {
                int messagesize = 0;
                try {
                    ChannelMessage data = (ChannelMessage) entry.data();
                    messagesize = data.getMessage().getLength();
                    sender.pushMessage(data);
                } catch (Exception x) {
                    log.warn(sm.getString(
                            "AsyncSocketSender.send.error", entry
                                    .getKey()), x);
View Full Code Here

Examples of org.apache.catalina.tribes.ChannelMessage

        FragCollection coll = getFragCollection(key,msg);
        coll.addMessage(msg);

        if ( coll.complete() ) {
            removeFragCollection(key);
            ChannelMessage complete = coll.assemble();
            super.messageReceived(complete);
           
        }
    }
View Full Code Here

Examples of org.apache.catalina.tribes.ChannelMessage

        int count = ((size / maxSize )+(size%maxSize==0?0:1));
        ChannelMessage[] messages = new ChannelMessage[count];
        int remaining = size;
        for ( int i=0; i<count; i++ ) {
            ChannelMessage tmp = msg.clone();
            int offset = (i*maxSize);
            int length = Math.min(remaining,maxSize);
            tmp.getMessage().clear();
            tmp.getMessage().append(msg.getMessage().getBytesDirect(),offset,length);
            //add the msg nr
            //tmp.getMessage().append(XByteBuffer.toBytes(i),0,4);
            tmp.getMessage().append(i);
            //add the total nr of messages
            //tmp.getMessage().append(XByteBuffer.toBytes(count),0,4);
            tmp.getMessage().append(count);
            //add true as the frag flag
            //byte[] flag = XByteBuffer.toBytes(true);
            //tmp.getMessage().append(flag,0,flag.length);
            tmp.getMessage().append(true);
            messages[i] = tmp;
            remaining -= length;
           
        }
        for ( int i=0; i<messages.length; i++ ) {
View Full Code Here

Examples of org.apache.catalina.tribes.ChannelMessage

    private boolean forwardExpired = true;
    private int maxQueue = Integer.MAX_VALUE;

    public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
        for ( int i=0; i<destination.length; i++ ) {
            ChannelMessage tmp = msg.clone();
            int nr = incCounter(destination[i]);
            //reduce byte copy
            //tmp.getMessage().append(XByteBuffer.toBytes(nr),0,4);
            tmp.getMessage().append(nr);
            getNext().sendMessage(new Member[] {destination[i]}, tmp, payload);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.