public void attach(ChannelSource source, PhysicalConnectionTarget target, ChannelConnection connection) throws Fabric3Exception { connection.setCloseable(() -> { // no-op }); if (target.isDirectConnection()) { // no event stream to attach since this is a direct connection return; } URI uri = source.getUri(); Channel channel = getChannel(uri, source.getChannelSide()); URI targetUri = target.getUri(); channel.subscribe(targetUri, connection); }
public void attach(ChannelSource source, PhysicalConnectionTarget target, ChannelConnection connection) throws Fabric3Exception { connection.setCloseable(() -> { // no-op }); if (target.isDirectConnection()) { // no event stream to attach since this is a direct connection return; } URI uri = source.getUri(); Channel channel = getChannel(uri, source.getChannelSide()); URI targetUri = target.getUri(); channel.subscribe(targetUri, connection); }
public void detach(ChannelSource source, PhysicalConnectionTarget target) throws Fabric3Exception { if (target.isDirectConnection()) { // no event stream to attach since this is a direct connection return; } URI uri = source.getUri(); Channel channel = getChannel(uri, source.getChannelSide()); URI targetUri = target.getUri(); channel.unsubscribe(targetUri, target.getTopic()); }
public void detach(ChannelSource source, PhysicalConnectionTarget target) throws Fabric3Exception { if (target.isDirectConnection()) { // no event stream to attach since this is a direct connection return; } URI uri = source.getUri(); Channel channel = getChannel(uri, source.getChannelSide()); URI targetUri = target.getUri(); channel.unsubscribe(targetUri, target.getTopic()); }
PhysicalConnectionSource source = physicalConnection.getSource(); PhysicalConnectionTarget target = physicalConnection.getTarget(); if (source.isDirectConnection() || target.isDirectConnection()) {
public void attach(NATSConnectionSource source, PhysicalConnectionTarget target, ChannelConnection connection) { String topic = source.getTopic() != null ? source.getTopic() : source.getDefaultTopic(); connection.setCloseable(() -> connectionManager.release(source.getChannelUri(), topic)); if (target.isDirectConnection()) { Class<?> type = target.getServiceInterface(); connectionManager.createDirectConsumer(type, source); // create consumer, which will be returned by the direct connection factory } else { String deserializerName = source.getData().getDeserializer(); Function deserializer = deserializerName != null ? InstanceResolver.getInstance(deserializerName, info, cm) : null; connection.getEventStream().addHandler(0, new EventStreamHandler() { private EventStreamHandler next; @SuppressWarnings("unchecked") public void handle(Object message, boolean batch) { Object body = deserializer != null ? deserializer.apply(message) : message; next.handle(body, batch); } public void setNext(EventStreamHandler next) { this.next = next; } public EventStreamHandler getNext() { return next; } }); connectionManager.subscribe(source, connection); } }
PhysicalConnectionSource source = physicalConnection.getSource(); PhysicalConnectionTarget target = physicalConnection.getTarget(); if (source.isDirectConnection() || target.isDirectConnection()) {