use of org.oasis_open.docs.wsn.b_2.Notify in project cxf by apache.
the class Consumer method notify.
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);
}
}
use of org.oasis_open.docs.wsn.b_2.Notify in project cxf by apache.
the class AbstractNotificationBroker method handleNotify.
protected void handleNotify(Notify notify) {
for (NotificationMessageHolderType messageHolder : notify.getNotificationMessage()) {
W3CEndpointReference producerReference = messageHolder.getProducerReference();
AbstractPublisher publisher = getPublisher(producerReference);
if (publisher != null) {
publisher.notify(messageHolder);
}
}
}
use of org.oasis_open.docs.wsn.b_2.Notify in project cxf by apache.
the class JmsPublisher method notify.
@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 e) {
LOGGER.log(Level.WARNING, "Error dispatching message", e);
} catch (JAXBException e) {
LOGGER.log(Level.WARNING, "Error dispatching message", e);
} catch (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);
}
}
}
}
use of org.oasis_open.docs.wsn.b_2.Notify in project cxf by apache.
the class JmsPullPoint method store.
@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);
}
}
use of org.oasis_open.docs.wsn.b_2.Notify in project bgpcep by opendaylight.
the class BGPSessionImplTest method testHoldTimerExpire.
@Test
public void testHoldTimerExpire() throws InterruptedException {
this.bgpSession.sessionUp();
checkIdleState(this.listener);
Assert.assertEquals(3, this.receivedMsgs.size());
Assert.assertTrue(this.receivedMsgs.get(2) instanceof Notify);
final Notify error = (Notify) this.receivedMsgs.get(2);
Assert.assertEquals(BGPError.HOLD_TIMER_EXPIRED.getCode(), error.getErrorCode().shortValue());
Assert.assertEquals(BGPError.HOLD_TIMER_EXPIRED.getSubcode(), error.getErrorSubcode().shortValue());
Mockito.verify(this.speakerListener).close();
}
Aggregations