/** * Create an instance of {@link Notify } * */ public Notify createNotify() { return new Notify(); }
@Override protected void store(NotificationMessageHolderType messageHolder) { try { initSession(); Notify notify = new Notify(); notify.getNotificationMessage().add(messageHolder); StringWriter writer = new StringWriter(); jaxbContext.createMarshaller().marshal(notify, writer); synchronized (producerSession) { Message message = producerSession.createTextMessage(writer.toString()); producer.send(message); } } catch (JMSException e) { LOGGER.log(Level.WARNING, "Error storing message", e); closeSession(); } catch (JAXBException e) { LOGGER.log(Level.WARNING, "Error storing message", e); } }
static String GetTopicList(Notify n) { String s = new String(); if (n == null) { return s; } for (int i = 0; i < n.getNotificationMessage().size(); i++) { if (n.getNotificationMessage().get(i).getTopic() != null) { if (n.getNotificationMessage().get(i).getTopic().getContent() != null) { for (int k = 0; k < n.getNotificationMessage().get(i).getTopic().getContent().size(); k++) { s = s + " " + n.getNotificationMessage().get(i).getTopic().getContent().get(k).toString(); } } } } return s.trim(); }
@Override public void notify(NotificationMessageHolderType messageHolder) { Session session = null; try { Topic topic = topicConverter.toActiveMQTopic(messageHolder.getTopic()); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(topic); Notify notify = new Notify(); notify.getNotificationMessage().add(messageHolder); StringWriter writer = new StringWriter(); jaxbContext.createMarshaller().marshal(notify, writer); Message message = session.createTextMessage(writer.toString()); producer.send(message); } catch (JMSException | JAXBException | InvalidTopicException e) { LOGGER.log(Level.WARNING, "Error dispatching message", e); } finally { if (session != null) { try { session.close(); } catch (JMSException e) { LOGGER.log(Level.FINE, "Error closing session", e); } } } }
/** * * @param notify */ @WebMethod(operationName = "Notify") @Oneway public void notify( @WebParam(name = "Notify", targetNamespace = "http://docs.oasis-open.org/wsn/b-1", partName = "Notify") Notify notify) { LOGGER.finest("Notify"); for (NotificationMessageHolderType messageHolder : notify.getNotificationMessage()) { store(messageHolder); } }
public void notify(Referencable publisher, String topic, Object msg) { getBroker(); if (this.context != null) { try { DOMResult result = new DOMResult(); context.createMarshaller().marshal(msg, result); msg = result.getNode(); if (msg instanceof Document) { msg = ((Document)msg).getDocumentElement(); } } catch (JAXBException e) { //ignore, we'll try and let the runtime handle it as is } } Notify notify = new Notify(); NotificationMessageHolderType holder = new NotificationMessageHolderType(); if (publisher != null) { holder.setProducerReference(publisher.getEpr()); } if (topic != null) { TopicExpressionType topicExp = new TopicExpressionType(); topicExp.getContent().add(topic); holder.setTopic(topicExp); } holder.setMessage(new NotificationMessageHolderType.Message()); holder.getMessage().setAny(msg); notify.getNotificationMessage().add(holder); getBroker().notify(notify); }
/** * Create an instance of {@link Notify } * */ public Notify createNotify() { return new Notify(); }
protected void handleNotify(Notify notify) { for (NotificationMessageHolderType messageHolder : notify.getNotificationMessage()) { W3CEndpointReference producerReference = messageHolder.getProducerReference(); AbstractPublisher publisher = getPublisher(producerReference); if (publisher != null) { publisher.notify(messageHolder); } } }
NotificationMessageHolderType... notificationMessages) throws TranslationException { Notify notify = new Notify(); notificationMessage.setTopic(createTopicExpressionType(topic)); notify.getNotificationMessage().add(notificationMessage);
(function() { var notify = new Notify({ container: document.getElementById('alerts'), template: `<div class="alert alert-{{type}}" role="alert"><div class="text-center">{{message}}</div></div>` }); notify.danger('Some error message'); }());
List<SubscriptionInfo> clients = GetMatchingSubscribers(notify.getNotificationMessage()); log.log(Level.INFO, GetTopicList(notify)); log.log(Level.INFO, "Dispatching WSN-Notify, msg count:" + notify.getNotificationMessage().size() + " to " + clients.size() + " subscribers"); NotificationBroker port = null; BindingProvider bp = null;
CompoundEvent... compoundEvents) throws TranslationException { Notify notify = new Notify(); notificationMessage.setTopic(createTopicExpressionType(topic)); notify.getNotificationMessage().add(notificationMessage);
/** * Create an instance of {@link Notify } * */ public Notify createNotify() { return new Notify(); }
public void onMessage(Message jmsMessage) { try { TextMessage text = (TextMessage) jmsMessage; XMLStreamReader reader = StaxUtils.createXMLStreamReader(new StringReader(text.getText())); Notify notify = (Notify) jaxbContext.createUnmarshaller() .unmarshal(reader); reader.close(); for (Iterator<NotificationMessageHolderType> ith = notify.getNotificationMessage().iterator(); ith.hasNext();) { NotificationMessageHolderType h = ith.next(); Object content = h.getMessage().getAny(); if (!(content instanceof Element)) { DocumentFragment doc = DOMUtils.getEmptyDocument().createDocumentFragment(); jaxbContext.createMarshaller().marshal(content, doc); content = DOMUtils.getFirstElement(doc); } if (!doFilter((Element) content)) { ith.remove(); } else { h.setTopic(topic); h.setSubscriptionReference(getEpr()); } } if (!notify.getNotificationMessage().isEmpty()) { doNotify(notify); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Error notifying consumer", e); } }
String producerReference, Object payload) { Notify notify = new Notify(); NotificationMessageHolderType notificationMessage = new NotificationMessageHolderType(); notificationMessage.setMessage(message); notify.getNotificationMessage().add(notificationMessage);
@RequestMapping(value = "/test-notification", method = RequestMethod.POST) public void testNotification(@RequestBody String recipientId) throws InterruptedException { this.template.convertAndSendToUser(recipientId,"/greetings", new Notify("ALERT: There is a new notification for you!")); }
public void notify( @WebParam(partName = "Notify", name = "Notify", targetNamespace = "http://docs.oasis-open.org/wsn/b-2") Notify notify) { for (NotificationMessageHolderType message : notify.getNotificationMessage()) { if (context != null) { Object o = message.getMessage().getAny(); if (o instanceof Element) { try { o = context.createUnmarshaller().unmarshal((Element)o); message.getMessage().setAny(o); } catch (JAXBException e) { //ignore, leave as a DOM } } } this.callback.notify(message); } } }
Notify notify = new Notify(); NotificationMessageHolderType msg = new NotificationMessageHolderType(); notify.getNotificationMessage().add(msg); try {
messages.addAll(notify.getNotificationMessage());