private PhysicalChannelConnectionDefinition generateProducerConnection(LogicalProducer producer, LogicalChannel channel, PhysicalConnectionSourceDefinition sourceDefinition, URI classLoaderId, PhysicalEventStreamDefinition eventStream) throws GenerationException { if (!channel.getZone().equals(producer.getParent().getZone()) && !channel.isBound()) { String name = channel.getDefinition().getName(); throw new GenerationException("Binding not configured on a channel where the producer is in a different zone: " + name); } PhysicalConnectionTargetDefinition targetDefinition = new ChannelTargetDefinition(channel.getUri(), ChannelSide.PRODUCER); targetDefinition.setClassLoaderId(classLoaderId); return new PhysicalChannelConnectionDefinition(sourceDefinition, targetDefinition, eventStream); }
private PhysicalChannelConnectionDefinition generateConsumerConnection(LogicalConsumer consumer, LogicalChannel channel, PhysicalConnectionTargetDefinition targetDefinition, URI classLoaderId, PhysicalEventStreamDefinition eventStream) throws GenerationException { // the channel does not have bindings, which means it is a local channel if (!channel.getZone().equals(consumer.getParent().getZone()) && !channel.isBound()) { String name = channel.getDefinition().getName(); throw new GenerationException("Binding not configured on a channel where the consumer is in a different zone: " + name); } // construct a local connection to the channel PhysicalConnectionSourceDefinition sourceDefinition = new ChannelSourceDefinition(channel.getUri(), ChannelSide.CONSUMER); sourceDefinition.setSequence(consumer.getDefinition().getSequence()); sourceDefinition.setClassLoaderId(classLoaderId); return new PhysicalChannelConnectionDefinition(sourceDefinition, targetDefinition, eventStream); }