Search in sources :

Example 1 with ResponseBufferCommand

use of io.mycat.mysqlclient.command.ResponseBufferCommand in project Mycat2 by MyCATApache.

the class VertxConnection method query.

public Observable<Buffer> query(String sql) {
    Observable<Buffer> objectObservable = Observable.create(emitter -> {
        synchronized (VertxConnection.this) {
            future = future.flatMap(new Function<Void, Future<Void>>() {

                @Override
                public Future<Void> apply(Void unused) {
                    return Future.future((promise) -> {
                        checkException();
                        ResponseBufferCommand bufferedResponseHandler = new ResponseBufferCommand(netSocket, sql, config, !NewMycatConnectionConfig.PASS_HALF_PACKET, emitter) {

                            @Override
                            public void onEnd() {
                                super.onEnd();
                                promise.tryComplete();
                            }
                        };
                        netSocket.handler(bufferedResponseHandler);
                        bufferedResponseHandler.write();
                    });
                }
            });
        }
    });
    return objectObservable;
}
Also used : Buffer(io.vertx.core.buffer.Buffer) Function(java.util.function.Function) ResponseBufferCommand(io.mycat.mysqlclient.command.ResponseBufferCommand)

Aggregations

ResponseBufferCommand (io.mycat.mysqlclient.command.ResponseBufferCommand)1 Buffer (io.vertx.core.buffer.Buffer)1 Function (java.util.function.Function)1