Search in sources :

Example 1 with CreateOperation

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

the class ZooKeeperProducer method createNode.

private OperationResult<String> createNode(ProductionContext ctx) throws Exception {
    CreateOperation create = new CreateOperation(ctx.connection, ctx.node);
    create.setPermissions(getAclListFromMessage(ctx.exchange.getIn()));
    CreateMode mode = null;
    String modeString = configuration.getCreateMode();
    if (modeString != null) {
        try {
            mode = getCreateModeFromString(modeString, CreateMode.EPHEMERAL);
        } catch (Exception e) {
        }
    } else {
        mode = getCreateMode(ctx.exchange.getIn(), CreateMode.EPHEMERAL);
    }
    create.setCreateMode(mode == null ? CreateMode.EPHEMERAL : mode);
    create.setData(ctx.payload);
    return create.get();
}
Also used : CreateOperation(org.apache.camel.component.zookeeper.operations.CreateOperation) CreateMode(org.apache.zookeeper.CreateMode) ZooKeeperUtils.getCreateMode(org.apache.camel.component.zookeeper.ZooKeeperUtils.getCreateMode) ZooKeeperUtils.getCreateModeFromString(org.apache.camel.component.zookeeper.ZooKeeperUtils.getCreateModeFromString)

Aggregations

ZooKeeperUtils.getCreateMode (org.apache.camel.component.zookeeper.ZooKeeperUtils.getCreateMode)1 ZooKeeperUtils.getCreateModeFromString (org.apache.camel.component.zookeeper.ZooKeeperUtils.getCreateModeFromString)1 CreateOperation (org.apache.camel.component.zookeeper.operations.CreateOperation)1 CreateMode (org.apache.zookeeper.CreateMode)1