The Talon Manual

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Implementing an Executor Bus Processor Factory

The processor bus factory returns instances of a processor for use by the executor bus. The executor bus will create a processor when the bus is created. In an AepEngine this will be when an engine is activated.

Code Block
titleConfiguration
/**
 * Factory for creating EmailGatewayProcessors
 */
public class EmailGatewayProcessorFactory extends AbstractExecutorBusProcessorFactory {
    private static volatile EmailGatewayProcessor emailGatewayProcessor;

    /* (non-Javadoc)
     * @see com.neeve.sma.spi.executor.AbstractExecutorBusProcessorFactory#createExecutorBusProcessor(com.neeve.sma.MessageBusBinding)
     */
    @Override
    public ExecutorBusProcessor createExecutorBusProcessor(MessageBusBinding binding) {
        return emailGatewayProcessornew EmailGatewayProcessor();
    }
    /**
     * Registers the tibco send processor. 
     * 
     * @param tibcoSendProcessor The tibco send processor. 
     */
    public static void register(SolaceToRvBridge tibcoSendProcessor) {
        PumaExecutorBusProcessorProvider.tibcoSendProcessor = tibcoSendProcessor;
    }
}}
Tip
titleExecutor Bus Processor Dependencies

If the class implementing ExecutorBusProcessor is a class created through a DI framework or if it needs access to other objects in your application and thus needs to be wired up before bus configurattion, consider registering the instance of your process as either a static variable in the bus processor factory. If you have multiple processor instances you can store them in a static map and use the bus binding descriptor to determine which instance to return. Some binding configuration that is useful in this regard includes:

  • binding.getUsername(): The name of the engine creating the bus.
  • binding.getName(): The name of the bus as configured in DDL
  • binding.getAddress(): The address as configured in DDL.
  • binding.getDescriptor().getProperties(): Binding properties as configured in DDL.

Example: Creating an E-mail Alert Gateway

...