Examples of EtCouchbaseClient


Examples of com.englishtown.vertx.clients.EtCouchbaseClient

        }
    }

    private void doReadChunk(final Message<JsonObject> message) {
        try {
            EtCouchbaseClient client = clientFactory.getClient(couchHosts, getMandatoryString("bucket", message), password);
            String fileId = getMandatoryString("files_id", message);
            Number n = getMandatoryNumber("n", message);
            String key = fileId + "!" + n;

            client.asyncGet(key, new FutureCallback<Object>() {
                @Override
                public void onSuccess(Object o) {
                    message.reply((byte[]) o);
                }
View Full Code Here

Examples of com.englishtown.vertx.clients.EtCouchbaseClient

            sendError(message, "Error while extracting message", e);
            return;
        }

        try {
            EtCouchbaseClient client = clientFactory.getClient(couchHosts, jsonObject.getString("bucket"), password);
            String key = jsonObject.getString("files_id") + "!" + jsonObject.getNumber("n");

            if (asyncWrites) {
                client.set(key, data, PersistTo.ZERO, ReplicateTo.ZERO);
            } else {
                client.set(key, data).get();
            }
            sendOK(message);
        } catch (Exception e) {
            sendError(message, "Error while writing to database", e);
        }
View Full Code Here

Examples of com.englishtown.vertx.clients.EtCouchbaseClient

        }
    }

    private void doGetDocument(final Message<JsonObject> message) {
        try {
            EtCouchbaseClient client = clientFactory.getClient(couchHosts, getMandatoryString("bucket", message), password);
            String key = getMandatoryString("key", message);
            client.asyncGet(key, new FutureCallback<String>() {
                @Override
                public void onSuccess(String s) {
                    sendOK(message, (s == null ? new JsonObject() : new JsonObject(s)));
                }
View Full Code Here

Examples of com.englishtown.vertx.clients.EtCouchbaseClient

        }
    }

    private void doSaveDocument(Message<JsonObject> message) {
        try {
            EtCouchbaseClient client = clientFactory.getClient(couchHosts, getMandatoryString("bucket", message), password);
            String id = getMandatoryString("id", message);
            String document = getMandatoryObject("document", message).toString();

            if (asyncWrites) {
                client.set(id, document, PersistTo.ZERO, ReplicateTo.ZERO);
            } else {
                client.set(id, document).get();
            }

            sendOK(message);
        } catch (Exception e) {
            sendError(message, e.getMessage());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.