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;
}
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());
}
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;
}
Aggregations