Search in sources :

Example 1 with BeginFW

use of io.aklivity.zilla.runtime.binding.echo.internal.types.stream.BeginFW in project zilla by aklivity.

the class EchoServerFactory method doBegin.

private void doBegin(final MessageConsumer receiver, final long routeId, final long streamId, final long sequence, final long acknowledge, final int maximum, final long traceId, final long authorization, final long affinity, final OctetsFW extension) {
    final BeginFW begin = beginRW.wrap(writeBuffer, 0, writeBuffer.capacity()).routeId(routeId).streamId(streamId).sequence(sequence).acknowledge(acknowledge).maximum(maximum).traceId(traceId).authorization(authorization).affinity(affinity).extension(extension).build();
    receiver.accept(begin.typeId(), begin.buffer(), begin.offset(), begin.sizeof());
}
Also used : BeginFW(io.aklivity.zilla.runtime.binding.echo.internal.types.stream.BeginFW)

Example 2 with BeginFW

use of io.aklivity.zilla.runtime.binding.echo.internal.types.stream.BeginFW in project zilla by aklivity.

the class EchoServerFactory method newStream.

@Override
public MessageConsumer newStream(int msgTypeId, DirectBuffer buffer, int index, int length, MessageConsumer sender) {
    final BeginFW begin = beginRO.wrap(buffer, index, index + length);
    final long routeId = begin.routeId();
    final long authorization = begin.authorization();
    final BindingConfig binding = router.resolve(routeId, authorization);
    MessageConsumer newStream = null;
    if (binding != null) {
        final long initialId = begin.streamId();
        newStream = new EchoServer(sender, routeId, initialId)::onMessage;
    }
    return newStream;
}
Also used : MessageConsumer(io.aklivity.zilla.runtime.engine.binding.function.MessageConsumer) BindingConfig(io.aklivity.zilla.runtime.engine.config.BindingConfig) BeginFW(io.aklivity.zilla.runtime.binding.echo.internal.types.stream.BeginFW)

Aggregations

BeginFW (io.aklivity.zilla.runtime.binding.echo.internal.types.stream.BeginFW)2 MessageConsumer (io.aklivity.zilla.runtime.engine.binding.function.MessageConsumer)1 BindingConfig (io.aklivity.zilla.runtime.engine.config.BindingConfig)1