Package io.reactivex.netty.contexts

Examples of io.reactivex.netty.contexts.ContextsContainer.addContext()


                                                                  REQUEST_ID_HEADER_NAME,
                                                                  RxContexts.DEFAULT_CORRELATOR)
                          .withMaxConnections(1).enableWireLogging(LogLevel.ERROR)
                          .withIdleConnectionsTimeoutMillis(100000).build();
        ContextsContainer container = new ContextsContainerImpl(new MapBackedKeySupplier());
        container.addContext(CTX_1_NAME, CTX_1_VAL);
        container.addContext(CTX_2_NAME, CTX_2_VAL, new TestContextSerializer());

        String reqId = "testWithPooledConnections";
        RxContexts.DEFAULT_CORRELATOR.onNewServerRequest(reqId, container);
View Full Code Here


                                                                  RxContexts.DEFAULT_CORRELATOR)
                          .withMaxConnections(1).enableWireLogging(LogLevel.ERROR)
                          .withIdleConnectionsTimeoutMillis(100000).build();
        ContextsContainer container = new ContextsContainerImpl(new MapBackedKeySupplier());
        container.addContext(CTX_1_NAME, CTX_1_VAL);
        container.addContext(CTX_2_NAME, CTX_2_VAL, new TestContextSerializer());

        String reqId = "testWithPooledConnections";
        RxContexts.DEFAULT_CORRELATOR.onNewServerRequest(reqId, container);

        invokeMockServer(testClient, reqId, false);
View Full Code Here

                                                                  RxContexts.DEFAULT_CORRELATOR)
                          .withMaxConnections(1).enableWireLogging(LogLevel.ERROR)
                          .withIdleConnectionsTimeoutMillis(100000).build();

        ContextsContainer container = new ContextsContainerImpl(new MapBackedKeySupplier());
        container.addContext(CTX_1_NAME, CTX_1_VAL);
        container.addContext(CTX_2_NAME, CTX_2_VAL, new TestContextSerializer());

        String reqId = "testNoStateLeakOnThreadReuse";
        RxContexts.DEFAULT_CORRELATOR.onNewServerRequest(reqId, container);
View Full Code Here

                          .withMaxConnections(1).enableWireLogging(LogLevel.ERROR)
                          .withIdleConnectionsTimeoutMillis(100000).build();

        ContextsContainer container = new ContextsContainerImpl(new MapBackedKeySupplier());
        container.addContext(CTX_1_NAME, CTX_1_VAL);
        container.addContext(CTX_2_NAME, CTX_2_VAL, new TestContextSerializer());

        String reqId = "testNoStateLeakOnThreadReuse";
        RxContexts.DEFAULT_CORRELATOR.onNewServerRequest(reqId, container);

        try {
View Full Code Here

                }
                ContextsContainer container = getCurrentContextContainer();
                if (null == container) {
                    return Observable.error(new AssertionError("Context container not found by server."));
                }
                container.addContext(CTX_1_NAME, CTX_1_VAL);
                container.addContext(CTX_2_NAME, CTX_2_VAL, new TestContextSerializer());

                HttpClient<ByteBuf, ByteBuf> client =
                        RxContexts.<ByteBuf, ByteBuf>newHttpClientBuilder("localhost", mockServer.getServerPort(),
                                                                          REQUEST_ID_HEADER_NAME,
View Full Code Here

                ContextsContainer container = getCurrentContextContainer();
                if (null == container) {
                    return Observable.error(new AssertionError("Context container not found by server."));
                }
                container.addContext(CTX_1_NAME, CTX_1_VAL);
                container.addContext(CTX_2_NAME, CTX_2_VAL, new TestContextSerializer());

                HttpClient<ByteBuf, ByteBuf> client =
                        RxContexts.<ByteBuf, ByteBuf>newHttpClientBuilder("localhost", mockServer.getServerPort(),
                                                                          REQUEST_ID_HEADER_NAME,
                                                                          RxContexts.DEFAULT_CORRELATOR)
View Full Code Here

    }

    public void addSerializedContext(HttpMessage httpMessage, String ctxName, String strCtxValue)
    throws ContextSerializationException {
        ContextsContainer contextsContainer = new ContextsContainerImpl(keySupplier);
        contextsContainer.addContext(ctxName, strCtxValue);
        Map<String,String> serializedContexts = contextsContainer.getSerializedContexts();
        for (Map.Entry<String, String> entry : serializedContexts.entrySet()) {
            httpMessage.headers().add(entry.getKey(), entry.getValue());
        }
    }
View Full Code Here

    }

    public <T> void addSerializedContext(HttpMessage httpMessage, String ctxName, T ctx,
                                     ContextSerializer<T> serializer) throws ContextSerializationException {
        ContextsContainer contextsContainer = new ContextsContainerImpl(keySupplier);
        contextsContainer.addContext(ctxName, ctx, serializer);
        Map<String,String> serializedContexts = contextsContainer.getSerializedContexts();
        for (Map.Entry<String, String> entry : serializedContexts.entrySet()) {
            httpMessage.headers().add(entry.getKey(), entry.getValue());
        }
    }
View Full Code Here

        ContextsContainer container = ContextAttributeStorageHelper.getContainer(holder.ctx, holder.requestId);
        String ctx2Name = "ctx2";
        BidirectionalTestContext ctx2 = new BidirectionalTestContext(ctx2Name);

        container.addContext(ctx2Name, ctx2, new BidirectionalTestContextSerializer());

        HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);

        holder.handler.write(holder.ctx, response, holder.ctx.newPromise());
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.