public void send(Destination realDestination, Message message, int realDeliveryMode, int realPriority, long realTimeToLive) throws JMSException { if (state == State.CLOSED) { throw new IllegalStateException("DwrMessageProducer has been closed"); } if (!disableMessageID) { message.setJMSMessageID(UUID.randomUUID().toString()); } if (!disableMessageTimestamp) { message.setJMSTimestamp(new Date().getTime()); } if (realDestination instanceof DwrTopic) { DwrTopic dwrtopic = (DwrTopic) realDestination; String topicName = dwrtopic.getTopicName(); hub.publish(topicName, message); } else { throw new IllegalStateException("Unsuported Destination type (" + realDestination.getClass().getCanonicalName() + "). Only Topics are currently supported."); } }
/** * Something has published to the client side 'hub' and we're getting to * know about it. * @param topic The topic that has been published to * @param data The published data */ public void publish(String topic, RealRawData data) { WebContext webContext = WebContextFactory.get(); ConverterManager converterManager = webContext.getContainer().getBean(ConverterManager.class); Hub hub = HubFactory.get(); MessageEvent event = new DefaultMessageEvent(hub, converterManager, data); hub.publish(topic, event); }