Search in sources :

Example 1 with TimeoutException

use of com.couchbase.client.core.deps.io.netty.handler.timeout.TimeoutException in project connectors-se by Talend.

the class BinaryParser method parse.

@Override
public Record parse(Collection collection, String id) {
    GetResult result;
    try {
        result = collection.get(id, GetOptions.getOptions().transcoder(RawBinaryTranscoder.INSTANCE));
    } catch (TimeoutException | CouchbaseException e) {
        LOG.error(e.getMessage());
        throw new ComponentException(e.getMessage());
    }
    byte[] data = result.contentAs(byte[].class);
    final Record.Builder recordBuilder = builderFactory.newRecordBuilder(schemaBinaryDocument);
    recordBuilder.withString("id", id);
    recordBuilder.withBytes("content", data);
    return recordBuilder.build();
}
Also used : CouchbaseException(com.couchbase.client.core.error.CouchbaseException) GetResult(com.couchbase.client.java.kv.GetResult) ComponentException(org.talend.sdk.component.api.exception.ComponentException) Record(org.talend.sdk.component.api.record.Record) TimeoutException(com.couchbase.client.core.deps.io.netty.handler.timeout.TimeoutException)

Aggregations

TimeoutException (com.couchbase.client.core.deps.io.netty.handler.timeout.TimeoutException)1 CouchbaseException (com.couchbase.client.core.error.CouchbaseException)1 GetResult (com.couchbase.client.java.kv.GetResult)1 ComponentException (org.talend.sdk.component.api.exception.ComponentException)1 Record (org.talend.sdk.component.api.record.Record)1