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); } } }
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); }
message.setAny(messagePayload); notificationMessage.setMessage(message);
Message m = new Message(); m.setAny(xmlalert);
message.setAny(payload); notificationMessage.setMessage(message);