Examples of TopicKey


Examples of org.richfaces.application.push.TopicKey

    @Override
    protected void onMessage(String channel, String sender, String login, String hostname, String message) {
        try {
            Message messageObject = new Message(message, sender, DateFormat.getInstance().format(new Date()));
            getTopicsContext().publish(new TopicKey("chat", getMessagesSubtopic()), messageObject);
        } catch (MessageException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

    }

    @Override
    protected void onUserList(String channel, User[] users) {
        try {
            getTopicsContext().publish(new TopicKey("chat", getListSubtopic()), null);
        } catch (MessageException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

    }

    @Override
    protected void onJoin(String channel, String sender, String login, String hostname) {
        try {
            getTopicsContext().publish(new TopicKey("chat", getListSubtopic()), null);
            Message messageObject = new Message("joined channel", sender, DateFormat.getInstance().format(new Date()));
            getTopicsContext().publish(new TopicKey("chat", getMessagesSubtopic()), messageObject);
        } catch (MessageException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

    }

    @Override
    protected void onPart(String channel, String sender, String login, String hostname) {
        try {
            getTopicsContext().publish(new TopicKey("chat", getListSubtopic()), null);
            Message messageObject = new Message("left channel", sender, DateFormat.getInstance().format(new Date()));
            getTopicsContext().publish(new TopicKey("chat", getMessagesSubtopic()), messageObject);
        } catch (MessageException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

    }

    @Override
    protected void onNickChange(String oldNick, String login, String hostname, String newNick) {
        try {
            getTopicsContext().publish(new TopicKey("chat", getListSubtopic()), null);
            Message messageObject = new Message(" changed nick to " + newNick, oldNick, DateFormat.getInstance().format(
                    new Date()));
            getTopicsContext().publish(new TopicKey("chat", getMessagesSubtopic()), messageObject);
        } catch (MessageException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

    }

    @Override
    protected void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) {
        try {
            getTopicsContext().publish(new TopicKey("chat", getListSubtopic()), null);
            Message messageObject = new Message("left channel" + reason, sourceNick, DateFormat.getInstance()
                    .format(new Date()));
            getTopicsContext().publish(new TopicKey("chat", getMessagesSubtopic()), messageObject);
        } catch (MessageException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

    public void send() {
        this.sendMessage(CHANNEL_PREFIX + channelName, message);
        try {
            Message messageObject = new Message(message, this.getName(), DateFormat.getInstance().format(new Date()));
            getTopicsContext().publish(new TopicKey("chat", getMessagesSubtopic()), messageObject);
        } catch (MessageException e) {
            LOGGER.error(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

     * @param pushAnnotation used for creating adequate {@link TopicKey}
     * @return {@link TopicKey} resolved from given {@link Push} annotation given
     */
    public TopicKey resolveTopicKey(Push pushAnnotation) {
        if ("".equals(pushAnnotation.subtopic())) {
            return new TopicKey(pushAnnotation.topic());
        } else {
            return new TopicKey(pushAnnotation.topic(), pushAnnotation.subtopic());
        }
    }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

         * through {@link BeanManager}.
         */
        public void notify(Object payload) {
            TopicsContext topicsContext = getBeanReference(TopicsContext.class);
            TopicKeyResolver topicKeyResolver = getBeanReference(TopicKeyResolver.class);
            TopicKey topicKey = topicKeyResolver.resolveTopicKey(pushAnnotation);
            try {
                topicsContext.publish(topicKey, payload);
            } catch (MessageException e) {
                throw new PushCDIMessageException("Message wasn't successfully deliver", e);
            }
View Full Code Here

Examples of org.richfaces.application.push.TopicKey

    public Date getDate() {
        return new Date();
    }

    public void push() throws MessageException {
        TopicKey topicKey = new TopicKey("sampleAddress");
        TopicsContext topicsContext = TopicsContext.lookup();

        topicsContext.publish(topicKey, new Date().toString());

        System.out.println("push event");
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.