Search in sources :

Example 1 with BeginFW

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

the class FanServerFactory method newStream.

@Override
public MessageConsumer newStream(int msgTypeId, DirectBuffer buffer, int index, int length, MessageConsumer replyTo) {
    final BeginFW begin = beginRO.wrap(buffer, index, index + length);
    final long routeId = begin.routeId();
    final BindingConfig binding = bindings.get(routeId);
    MessageConsumer newStream = null;
    if (binding != null) {
        final long initialId = begin.streamId();
        final long replyId = supplyReplyId.applyAsLong(initialId);
        final FanServerGroup group = supplyFanServerGroup(binding.exit.id);
        newStream = new FanServer(group, routeId, initialId, replyId, replyTo)::onMemberMessage;
    }
    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.fan.internal.types.stream.BeginFW)

Example 2 with BeginFW

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

the class FanServerFactory method doBegin.

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

Example 3 with BeginFW

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

the class FanServerFactory method newStream.

private MessageConsumer newStream(MessageConsumer sender, long routeId, long streamId, long sequence, long acknowledge, int maximum, long traceId, long authorization, long affinity, Consumer<OctetsFW.Builder> 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();
    MessageConsumer receiver = streamFactory.newStream(begin.typeId(), begin.buffer(), begin.offset(), begin.sizeof(), sender);
    receiver.accept(begin.typeId(), begin.buffer(), begin.offset(), begin.sizeof());
    return receiver;
}
Also used : MessageConsumer(io.aklivity.zilla.runtime.engine.binding.function.MessageConsumer) BeginFW(io.aklivity.zilla.runtime.binding.fan.internal.types.stream.BeginFW)

Aggregations

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