Class ServiceFromDatabase

All Implemented Interfaces:
ComponentLifecycle, ServiceExtractor

@ComponentProfile(summary="Extract the service to execute from a database", recommended=DatabaseConnection.class, since="3.8.4") public class ServiceFromDatabase extends ExtractorWithConnection
Extract the service to execute from a database

This executes the configured query, takes the first column of the first ResultSet and uses that as the source for the dynamic service.

Since it supports the expression syntax; this is perfectly acceptable; It is up to you to protect against SQL injection attacks.

 SELECT dynamicService FROM services
        WHERE src='%message{source}'
              AND dest='%message{destination}'
              AND msgType='%message{messageType}'
 

The alternative to this would be to use JdbcDataQueryService with a FirstRowMetadataTranslator and subsequently a ServiceFromDataInputParameter (from metadata). That might be more performant as you would benefit from prepared statement caching and mitigate against SQL injection style attacks.

See Also:

In the adapter configuration file this class is aliased as dynamic-service-from-database which is the preferred alternative to the fully qualified classname when building your configuration.