Examples of TopicKey


Examples of org.richfaces.application.push.TopicKey

            return session;
        }

        private void sendMessage(String message) throws MessageException {
            TopicsContext topicsContext = TopicsContext.lookup();
            TopicKey topicKey = new TopicKey(Commons.TOPIC);
            topicsContext.getOrCreateTopic(topicKey);
            topicsContext.publish(topicKey, message);
        }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

        sendMessage(++count);
    }

    private void sendMessage(Object message) throws MessageException {
        TopicsContext topicsContext = TopicsContext.lookup();
        TopicKey topicKey = new TopicKey(AbstractPushTestWithoutWarp.TOPIC);
        topicsContext.getOrCreateTopic(topicKey);
        topicsContext.publish(topicKey, message);
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

                        while (true) {
                            Message message = consumer.receive();

                            if (message != null) {
                                String subtopicName = message.getStringProperty(SUBTOPIC_PROPERTY);
                                TopicKey topicKey = new TopicKey(name, subtopicName);

                                org.richfaces.application.push.Topic pushTopic = getOrCreateTopic(topicKey);
                                if (pushTopic != null) {
                                    try {
                                        Object messageData = getMessageData(message);
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

     *
     * @see org.richfaces.demo.push.MessageProducer#sendMessage()
     */
    public void sendMessage() throws Exception {
        try {
            TopicKey topicKey = new TopicKey(PUSH_TOPICS_CONTEXT_TOPIC);
            TopicsContext topicsContext = TopicsContext.lookup();
            topicsContext.publish(topicKey, "message");
        } catch (Exception e) {
            log.info("Sending push message using TopicContext failed (" + e.getMessage()
                    + ") - operation will be repeated in few seconds");
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

    /*
     * Metode que publica un missatge a un topic
     */
    public void say() {
        try {
            topicsContext.publish(new TopicKey("inmobles", subchannel), "hola");
        } catch (MessageException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

      e.printStackTrace();
    }
      
        TopicsContext topicsContext = TopicsContext.lookup();
       
        Topic topic = topicsContext.getOrCreateTopic(new TopicKey("inmobles"));
       
        topic.setMessageDataSerializer(DefaultMessageDataSerializer.instance());
       
        topic.addTopicListener(new SessionTopicListener() {
           
            public void processUnsubscriptionEvent(SessionUnsubscriptionEvent event) throws EventAbortedException {
                TopicKey topicKey = event.getTopicKey();
                Session session = event.getSession();
                System.out.println(MessageFormat.format("Session {0} disconnected from {1}", session.getId(), topicKey.getTopicAddress()));
            }
           
            public void processSubscriptionEvent(SessionSubscriptionEvent event) throws EventAbortedException {
                TopicKey topicKey = event.getTopicKey();
                Session session = event.getSession();
               
                FacesContext facesContext = FacesContext.getCurrentInstance();
                HttpServletRequest hsr = (HttpServletRequest) facesContext.getExternalContext().getRequest();
               
                System.out.println(MessageFormat.format("Session {0} connected to {1} from {2}", session.getId(),
                    topicKey.getTopicAddress(), hsr.getRemoteAddr()));
            }
           
            public void processPreSubscriptionEvent(SessionPreSubscriptionEvent event) throws EventAbortedException {
                ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
                ChatBean chatBean = (ChatBean) externalContext.getSessionMap().get("chatBean");
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

          FacesContext context = FacesContext.getCurrentInstance();
          InmobleForm inmobleForm = (InmobleForm) context.getApplication().evaluateExpressionGet(context, "#{inmobleForm}", InmobleForm.class);
          //UserForm comprador = (UserForm) context.getApplication().evaluateExpressionGet(context, "#{userForm}", UserForm.class);
         
          // ho enviem a la cua de l'usuari del venedor
            topicsContext.publish(new TopicKey("inmobles", inmobleForm.getVenedor() + canal), "solicitud de inmueble por comprador ");
        } catch (MessageException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

    /*
     * Metode que publica un missatge a un topic
     */
    public void say() {
        try {
            topicsContext.publish(new TopicKey("inmobles", subchannel), "hola");
        } catch (MessageException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

      e.printStackTrace();
    }
      
        TopicsContext topicsContext = TopicsContext.lookup();
       
        Topic topic = topicsContext.getOrCreateTopic(new TopicKey("inmobles"));
       
        topic.setMessageDataSerializer(DefaultMessageDataSerializer.instance());
       
        topic.addTopicListener(new SessionTopicListener() {
           
            public void processUnsubscriptionEvent(SessionUnsubscriptionEvent event) throws EventAbortedException {
                TopicKey topicKey = event.getTopicKey();
                Session session = event.getSession();
                System.out.println(MessageFormat.format("Session {0} disconnected from {1}", session.getId(), topicKey.getTopicAddress()));
            }
           
            public void processSubscriptionEvent(SessionSubscriptionEvent event) throws EventAbortedException {
                TopicKey topicKey = event.getTopicKey();
                Session session = event.getSession();
               
                FacesContext facesContext = FacesContext.getCurrentInstance();
                HttpServletRequest hsr = (HttpServletRequest) facesContext.getExternalContext().getRequest();
               
                System.out.println(MessageFormat.format("Session {0} connected to {1} from {2}", session.getId(),
                    topicKey.getTopicAddress(), hsr.getRemoteAddr()));
            }
           
            public void processPreSubscriptionEvent(SessionPreSubscriptionEvent event) throws EventAbortedException {
                ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
                ChatBean chatBean = (ChatBean) externalContext.getSessionMap().get("chatBean");
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.