Versions Compared

Key

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

Table of Contents

Transport adapter

Implementation

FEJ routing server provides the ability to integrate custom 3rdparty transports and use them for routing messages. For such goal server provides few interfaces for implementations:

Endpoint is a basic interface that represents instance of some entry, which could be unique identified by routing engine for receiving or delivering messages. EndpointParams provides unique id of such endpoint and other additional attributes, which may be useful for routing logic.

Code Block
languagejava
public interface Endpoint {
    EndpointParams getParams();
}

SourceEndpoint interface represent a provider of messages for routing engine.

Code Block
languagejava
public interface SourceEndpoint extends Endpoint {
    void setListener(SourceMessageListener listener);
}

It offers the ability to register listeners SourceMessageListener of incoming messages for external systems.

Code Block
languagejava
public interface SourceMessageListener {
    void onNewMessage(FIXFieldList message);
}

DestinationEndpoint represent a target of routing rules. It allows you to pass routed massage to the certain system.

Code Block
languagejava
public interface DestinationEndpoint extends Endpoint {
    /**
      * Send a {@link FIXFieldList} to this adapter. If the message is sent successfully,
      * the method returns {@code true}. If the message cannot be sent due to a
      * non-fatal reason, the method returns {@code false}. The method may also
      * throw a RuntimeException in case of non-recoverable errors.
      * <p>This method may block indefinitely, depending on the implementation.
      *
      * @param message the message to send
      * @return whether or not the message was sent
      */
     boolean send(FIXFieldList message);
}

There is also mechanism for registering such sources and destinations into server. After registration such endpoints will be accessible for routing engine. Registration of sources and destinations are independent. It means that you can register source and destination endpoint with the same id. This is especially important for bidirectional transports like FIX, where in and out connections are identified by the same parameters. For such transports exists 'BidirectionalEndpoint' interface.

Code Block
languagejava
public interface BidirectionalEndpoint extends ConsumerEndpoint, ProducerEndpoint {
}

Anyway, there are two separate interface for registering sources and destinations:

Code Block
languagejava
public interface SourceEndpointRegistry {
    void registerConsumer(SourceEndpoint consumer);
    void removeConsumer(String id);
}

public interface DestinationEndpointRegistry {
    void registerProducer(DestinationEndpoint producer);
    void removeProducer(String id);
}

Both they are implemented by EndpointRegistryAdapter class. it is available for accessing via Spring config:

...

languagexml

...

Child pages (Children Display)

Overview

FIXEdge Java functionality can be extended with custom modules if required. The new logic can be integrated via Spring configuration files. As a default extension point, use the conf/spring/custom-ext.xml configuration file. Add any custom Beans there.

The conf/spring/custom-ext.xml currently includes two Java Beans for extending Groovy rules with custom functionalities:  

  • Listing a bean with the customBLImports ID allows extending default imports for Groovy scripts:
Code Block
languagexml
<util:list id="customImports" value-type="java.lang.String">
	<!--Example of import value-->
	<value>java.util.concurrent.atomic.AtomicInteger</value>
</util:list>
  • Mapping a Bean with the customBLBeans ID allows adding custom Beans as variables to Groovy scripts:
Code Block
languagexml
<util:map id="customAdditionalProperties" key-type="java.lang.String">
	<!--Example-->
    <!-- exampleBean now is accessible in Groovy scripts -->
	<entry key="exampleBean" value-ref="testBean"/>
</util:map>

<bean id="testBean" class="java.lang.Object"/>