Search in sources :

Example 1 with PullPoint

use of org.apache.cxf.wsn.client.PullPoint in project cxf by apache.

the class WsnBrokerTest method testPullPoint.

@Test
public void testPullPoint() throws Exception {
    PullPoint pullPoint = createPullPoint.create();
    Subscription subscription = notificationBroker.subscribe(pullPoint, "myTopic");
    notificationBroker.notify("myTopic", new JAXBElement<String>(new QName("urn:test:org", "foo"), String.class, "bar"));
    boolean received = false;
    for (int i = 0; i < 50; i++) {
        List<NotificationMessageHolderType> messages = pullPoint.getMessages(10);
        if (!messages.isEmpty()) {
            received = true;
            break;
        }
        Thread.sleep(100);
    }
    assertTrue(received);
    subscription.unsubscribe();
    pullPoint.destroy();
}
Also used : QName(javax.xml.namespace.QName) JaxwsCreatePullPoint(org.apache.cxf.wsn.services.JaxwsCreatePullPoint) PullPoint(org.apache.cxf.wsn.client.PullPoint) CreatePullPoint(org.apache.cxf.wsn.client.CreatePullPoint) Subscription(org.apache.cxf.wsn.client.Subscription) NotificationMessageHolderType(org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType) JaxwsCreatePullPoint(org.apache.cxf.wsn.services.JaxwsCreatePullPoint) PullPoint(org.apache.cxf.wsn.client.PullPoint) CreatePullPoint(org.apache.cxf.wsn.client.CreatePullPoint) Test(org.junit.Test)

Example 2 with PullPoint

use of org.apache.cxf.wsn.client.PullPoint in project cxf by apache.

the class WsnBrokerTest method testPullPointWithQueueName.

@Test
public void testPullPointWithQueueName() throws Exception {
    PullPoint pullPoint = createPullPoint.create("testQueue");
    Subscription subscription = notificationBroker.subscribe(pullPoint, "myTopic");
    notificationBroker.notify("myTopic", new JAXBElement<String>(new QName("urn:test:org", "foo"), String.class, "bar"));
    boolean received = false;
    for (int i = 0; i < 50; i++) {
        List<NotificationMessageHolderType> messages = pullPoint.getMessages(10);
        if (!messages.isEmpty()) {
            received = true;
            break;
        }
        Thread.sleep(100);
    }
    assertTrue(received);
    subscription.unsubscribe();
    pullPoint.destroy();
}
Also used : QName(javax.xml.namespace.QName) JaxwsCreatePullPoint(org.apache.cxf.wsn.services.JaxwsCreatePullPoint) PullPoint(org.apache.cxf.wsn.client.PullPoint) CreatePullPoint(org.apache.cxf.wsn.client.CreatePullPoint) Subscription(org.apache.cxf.wsn.client.Subscription) NotificationMessageHolderType(org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType) JaxwsCreatePullPoint(org.apache.cxf.wsn.services.JaxwsCreatePullPoint) PullPoint(org.apache.cxf.wsn.client.PullPoint) CreatePullPoint(org.apache.cxf.wsn.client.CreatePullPoint) Test(org.junit.Test)

Aggregations

QName (javax.xml.namespace.QName)2 CreatePullPoint (org.apache.cxf.wsn.client.CreatePullPoint)2 PullPoint (org.apache.cxf.wsn.client.PullPoint)2 Subscription (org.apache.cxf.wsn.client.Subscription)2 JaxwsCreatePullPoint (org.apache.cxf.wsn.services.JaxwsCreatePullPoint)2 Test (org.junit.Test)2 NotificationMessageHolderType (org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType)2