/** * Create an instance of {@link NotificationMessageHolderType } * */ public NotificationMessageHolderType createNotificationMessageHolderType() { return new NotificationMessageHolderType(); }
public void notify(NotificationMessageHolderType message) { Object o = message.getMessage().getAny(); if (o instanceof Element) { Element e = (Element)o; System.out.println(); System.out.println("From: "+e.getElementsByTagNameNS(mailNs,"from").item(0).getTextContent()); System.out.println("To: "+e.getElementsByTagNameNS(mailNs,"to").item(0).getTextContent()); System.out.println("Subject: "+e.getElementsByTagNameNS(mailNs,"subject").item(0).getTextContent()); System.out.println("Body: "+e.getElementsByTagNameNS(mailNs,"body").item(0).getTextContent()); System.out.println(); }else { System.out.println(o); } } }, "http://localhost:9001/MyConsumer");
/** * Extracts and returns the topic QName contained by the specified * {@link NotificationMessageHolderType WS-Notification message}. * * @param notificationMessage * the WS-Notification message to analyze. * * @return the topic QName contained by the specified WS-Notification * message. */ public static QName getTopic(NotificationMessageHolderType notificationMessage) { return getTopic(notificationMessage.getTopic()); }
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); }
msg.getSubscriptionReference(), "subscriber"); logTopic(msg.getTopic(), ""); logW3CEndpointReference(msg.getProducerReference(), "producer"); Message message = msg.getMessage();
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); } }
NotificationMessageHolderType msg = new NotificationMessageHolderType(); RegisterProducer((String) tet.getContent().get(0)); msg.setTopic((tet)); Message m = new Message(); msg.setMessage(m); notify.getNotificationMessage().add(msg); try {
new NotificationMessageHolderType(); new W3CEndpointReferenceBuilder(); endPointReferenceBuilder.address(publicationSource); notificationMessage.setProducerReference(endPointReferenceBuilder.build()); notificationMessage.setMessage(message);
Map<Node, Node> messageNodes = new HashMap<Node, Node>(); if (notificationMessage.getTopic() != null) { QName topic = WsnHelper.getTopic(notificationMessage); String topicNamespace = topic.getNamespaceURI(); notificationMessage.getProducerReference(); String producerAddressUri = null; notificationMessage.getProducerReference(), "metadata"); if (metadata != null) { subjectNode = NodeFactory.createURI(eventId + "#event"); Message message = notificationMessage.getMessage(); if (message != null) { messageNodes = this.parseElement((Element) message.getAny(), false);
notificationMessage.setSubscriptionReference(createW3cEndpointReference(subscriptionReference)); if (simpleTopicExpression) { notificationMessage.setTopic(createTopicExpressionTypeWithSimpleExpressionType(topic)); } else { notificationMessage.setTopic(createTopicExpressionType(topic));
new ByteArrayInputStream( EventFormatHelpers.unwrapFromDomNativeMessageElement( (Element) notificationMessage.getMessage() .getAny()).getBytes()); notificationMessage.getProducerReference(); if (producerReference != null) { Object address = ReflectionUtils.getFieldValue( notificationMessage.getProducerReference(), "address"); if (address != null) {
protected void handleNotify(Notify notify) { for (NotificationMessageHolderType messageHolder : notify.getNotificationMessage()) { W3CEndpointReference producerReference = messageHolder.getProducerReference(); AbstractPublisher publisher = getPublisher(producerReference); if (publisher != null) { publisher.notify(messageHolder); } } }
Notify notify = new Notify(); NotificationMessageHolderType notificationMessage = new NotificationMessageHolderType(); notificationMessage.setSubscriptionReference(createW3cEndpointReference(subscriptionReference)); notificationMessage.setTopic(createTopicExpressionTypeWithSimpleExpressionType(topic)); notificationMessage.setProducerReference(createW3cEndpointReference(producerReference)); notificationMessage.setMessage(message);
NotificationMessageHolderType notificationMessage = translator.translate(event); notificationMessage.setSubscriptionReference(createW3cEndpointReference(subscriptionReference)); if (event.getGraph().getURI().endsWith( WsnConstants.SIMPLE_TOPIC_EXPRESSION_MARKER)) { notificationMessage.setTopic(createTopicExpressionTypeWithSimpleExpressionType(topic)); } else { notificationMessage.setTopic(createTopicExpressionType(topic));
new NotificationMessageHolderType(); topicExpression.getContent().add(topic); notificationMessage.setTopic(topicExpression); endPointReferenceBuilder.metadata(metadata); notificationMessage.setProducerReference(endPointReferenceBuilder.build()); Message message = new Message(); message.setAny(messagePayload); notificationMessage.setMessage(message);
/** * Create an instance of {@link NotificationMessageHolderType } * */ public NotificationMessageHolderType createNotificationMessageHolderType() { return new NotificationMessageHolderType(); }
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); } } }
/** * Indicates whether the topic of the specified * {@link NotificationMessageHolderType WS-Notification message} is defined * by a {@code simpleTopicExpression} element or not. * * @param notificationMessage * the WS-Notification message to analyze. * * @return true if the topic of the specified WS-Notification message is * defined by a {@code simpleTopicExpression} element, false * otherwise. */ public static boolean hasSimpleTopicExpression(NotificationMessageHolderType notificationMessage) { return hasSimpleTopicExpression(notificationMessage.getTopic()); }
/** * Create an instance of {@link NotificationMessageHolderType } * */ public NotificationMessageHolderType createNotificationMessageHolderType() { return new NotificationMessageHolderType(); }
if (notificationMessage.getMessage() != null) { if (notificationMessage.getMessage().getAny() != null) { Element e = (Element) notificationMessage.getMessage().getAny();