Search in sources :

Example 1 with GetChildrenOperation

use of org.apache.camel.component.zookeeper.operations.GetChildrenOperation in project camel by apache.

the class ZooKeeperProducerTest method setUsingCreateModeFromHeader.

@Test
public void setUsingCreateModeFromHeader() throws Exception {
    client.createPersistent("/modes-test", "parent for modes");
    for (CreateMode mode : CreateMode.values()) {
        Exchange exchange = createExchangeWithBody(testPayload);
        exchange.getIn().setHeader(ZOOKEEPER_CREATE_MODE, mode);
        exchange.getIn().setHeader(ZOOKEEPER_NODE, "/modes-test/" + mode);
        exchange.setPattern(ExchangePattern.InOut);
        template.send("direct:node-from-header", exchange);
    }
    GetChildrenOperation listing = new GetChildrenOperation(getConnection(), "/modes-test");
    assertEquals(CreateMode.values().length, listing.get().getResult().size());
}
Also used : Exchange(org.apache.camel.Exchange) CreateMode(org.apache.zookeeper.CreateMode) GetChildrenOperation(org.apache.camel.component.zookeeper.operations.GetChildrenOperation) Test(org.junit.Test)

Example 2 with GetChildrenOperation

use of org.apache.camel.component.zookeeper.operations.GetChildrenOperation in project camel by apache.

the class ZooKeeperConsumer method addBasicChildListingSequence.

private void addBasicChildListingSequence(String node) {
    operations.clear();
    operations.add(new AnyOfOperations(node, new ExistsOperation(connection, node), new ExistenceChangedOperation(connection, node)));
    operations.add(new GetChildrenOperation(connection, node));
    operations.add(new ChildrenChangedOperation(connection, node, false));
}
Also used : ChildrenChangedOperation(org.apache.camel.component.zookeeper.operations.ChildrenChangedOperation) ExistenceChangedOperation(org.apache.camel.component.zookeeper.operations.ExistenceChangedOperation) ExistsOperation(org.apache.camel.component.zookeeper.operations.ExistsOperation) AnyOfOperations(org.apache.camel.component.zookeeper.operations.AnyOfOperations) GetChildrenOperation(org.apache.camel.component.zookeeper.operations.GetChildrenOperation)

Aggregations

GetChildrenOperation (org.apache.camel.component.zookeeper.operations.GetChildrenOperation)2 Exchange (org.apache.camel.Exchange)1 AnyOfOperations (org.apache.camel.component.zookeeper.operations.AnyOfOperations)1 ChildrenChangedOperation (org.apache.camel.component.zookeeper.operations.ChildrenChangedOperation)1 ExistenceChangedOperation (org.apache.camel.component.zookeeper.operations.ExistenceChangedOperation)1 ExistsOperation (org.apache.camel.component.zookeeper.operations.ExistsOperation)1 CreateMode (org.apache.zookeeper.CreateMode)1 Test (org.junit.Test)1