Skip to content

Latest commit

 

History

History
348 lines (267 loc) · 19.8 KB

Readme.md

File metadata and controls

348 lines (267 loc) · 19.8 KB

../ IKASAN

Component Guide

Consumers

Starting component of the flow for which only one consumer may exist in any given flow.

Purpose

Consumers provide the "glue" between the entry into the flow and the underlying technology generating the event. In order to create your own consumer you need to implement Consumer Interface.

Types

All consumers are driven by event occurrences be this by scheduled time driven events or data driven events.

Schedule Driven Consumers

Invoked on a time based schedule, either relative or absolute. All scheduled consumers operate based on a Quartz scheduled invocation. This scheduled invocation can be to pull data from an underlying source system API or to simply invoke the next component in the flow. The MessageProvider set on the consumer dictates this behaviour, with off-the-shelf consumers having specific MessageProvider implementations to suit the required source system API.

The following consumers are off-the-shelf scheduled driven consumers.

Data Driven Consumers

Invoked by the underlying source system API which pushes one or more data events to the consumer.

The following consumers are off-the-shelf data driven consumers.

Converters

Purpose

Converters are used convert from one object type to another. Converters act as adapters between components requiring different input types. For instance, if you pass object A to a Converter the Converter may return the same object A or a completely different object as defined in the interface implementation.

In order to create your own converter you need to implement Converter Interface

Types

Translators

Purpose

Translators receive and return the same object, but allow for the constituent parts of that object to be changed. For instance, if you pass object A to a Translator the Translator may change the content of Object A, but cannot return a new object.

In order to create your own translator you need to implement Translator Interface

Types

As Translators tend to be very specific to the requirement Ikasan does not provide any pre-built Translators.

Brokers

Purpose

Brokers enrich the contents of the existing message with additional data or structure in a number of different ways. Request Response Brokers can make calls to other systems such as a database or HTTP(s) RESTful services. Aggregating Brokers consume all incoming messages until a condition is met ie aggregate every 10 messages. Re-Sequencing Brokers consume all incoming messages until a condition is met and then release them messages as a list of newly ordered events. This can provide a powerful function when combined with a Splitter as the next component.

In order to create your own broker you need to implement Converter Interface



Pattern

Types

  • Request Response Broker
  • Aggregating Broker
  • Re-Sequencing Broker

Splitters

Purpose

Splitters break up the incoming event in to many outgoing events. Ikasan will operate on the returned list of events and pass each event in the list independently to the next component for processing. Read more about EIP Sequencer In order to create your own splitter you need to implement Splitter Interface



Types

Filters

Purpose

A Filter will allow check to see if an incoming event matches a particular filter rule. If matched the event is dropped, if not matched then the event is passed to the next component. You can think of filter as of an 'IF' statment in a programming language. In order to create your own filter you need to implement Filter Interface

Types

Routers

Purpose

Read more about EIP Message Router In order to create your own router you need to implement SingleRecipientRouter Interface or MultiRecipientRouter Interface



Pattern

Types

Producers

Purpose

Ending component of the flow, or a route in the flow. Read more about EIP Message Endpoint In order to create your own broker you need to implement Producer Interface



Pattern

Types

Dev Null Producer

This type of producer discards all data passed to it and does not perform any processing.

Configuration Options

None.

Logging Producer

This type of producer logs all data passed to it.

Configuration Options
Option Type Purpose
regExpPattern String Optional. Standard regular expression to match content of the event for replacement with alternate values defined below.
replacementText String Optional. Replacement value for the above matched regExpPattern.
logEveryNth long Optional. Specifies the event will only be logged every Nth occurrence. Default is 1 - log every occurrence.

Email Producer

This type of producer sends an email. This requires an incoming EmailPayload event instance.

Configuration Options
Option Type Purpose
user String Optional. The default user name to use when connecting to the mail server. Used if the mail.protocol.user property isn't set.
password String Optional. Password for the mail server.
subject String Optional. Email subject line.
mailBody String Optional. Email body content.
runtimeEnvironment String Optional. Addition property which may be specified to denote the runtime instance generating the email. ie. dev, uat
toRecipient String Optional. Email recipient 'to' address
toRecipients List Optional. Email recipients 'to' addresses
ccRecipient String Optional. Email recipient 'cc' address
ccRecipients List Optional. Email recipients 'cc' addresses
bccRecipient String Optional. Email recipient 'bcc' address
bccRecipients List Optional. Email recipients 'bcc' addresses
hasAttachment boolean Optional. Whether the email has an attachment or not
extendedMailSessionProperties Map<String,String> Optional.
mailDebug boolean Optional. Run this in debug mode. Default is false.
mailFrom String Optional. The return email address of the current user, used by the InternetAddress method getLocalAddress.
mailMimeAddressStrict boolean Optional. The MimeMessage class uses the InternetAddress method parseHeader to parse headers in messages. This property controls the strict flag passed to the parseHeader method. The default is true.
mailHost String Optional. The default host name of the mail server for both Stores and Transports. Used if the mail.protocol.host property isn't set.
mailStoreProtocol String Optional. Specifies the default message access protocol.
mailTransportProtocol String Optional. Specifies the default message transport protocol.
mailSmtpClass String Optional. Specifies the fully qualified class name of the provider for the specified protocol. Used in cases where more than one provider for a given protocol exists; this property can be used to specify which provider to use by default.
mailSmtpHost String Optional. The host name of the mail server for the specified protocol. Overrides the mailHost property.
mailSmtpPort int Optional. The port number of the mail server for the specified protocol. If not specified the protocol's default port number is used.
mailSmtpUser String Optional. The user name to use when connecting to mail servers using the specified protocol. Overrides the user property.
mailPopClass String Optional. Specifies the fully qualified class name of the provider for the specified protocol. Used in cases where more than one provider for a given protocol exists; this property can be used to specify which provider to use by default.
mailPopPort int Optional. The port number of the mail server for the specified protocol. If not specified the protocol's default port number is used.
mailPopUser String Optional. The user name to use when connecting to mail servers using the specified protocol. Overrides the user property.
emailFormat String Optional. Forat for the email. ie. text/html

JMS Producer

The JMS producer is based on Spring template and is used to connect to any Vendor specific JMS Broker(ActiveMQ, HornetQ, IBM MQ etc). However one need to include the related vendor specific libraries in the IM.



Configuration Options
Option Type Purpose
destinationJNDIProperties Map<String,String> Optional JNDI parameters map. Typical map would include following keys :
  • java.naming.provider.url
  • java.naming.factory.initial
  • java.naming.factory.url.pkgs
  • java.naming.security.credentials
  • java.naming.security.principle
destinationJNDIName String Destination(Topic/Queue) name, which could refer as well to JNDI name
connectionFactoryJNDIProperties Map<String,String> Optional JNDI parameters map. Typical map would include following keys :
  • java.naming.provider.url
  • java.naming.factory.initial
  • java.naming.factory.url.pkgs
  • java.naming.security.credentials
  • java.naming.security.principle
connectionFactoryName String ConnectionFactoryName is required if not already passed on the constructor
connectionFactoryUsername String Authentication principal
connectionFactoryPassword String Id set on the JMS connection for durable subscribers
pubSubDomain boolean set to true to indicate that destination is a topic, otherwise destination is a queue
deliveryPersistent boolean Default(false) flag indicating whether publishing messages are persisted on the broker or hold in memory
deliveryMode integer
sessionTransacted boolean Sets whether the session should be part of a transaction.
explicitQosEnabled boolean Default(false)
messageIdEnabled boolean  Default(false)
messageTimestampEnabled boolean  Default(false)
priority Integer  Optional allows to set message priority on the message. This option will only work if the broker or/and consumer are configured to use the priority when dispatching/consuming messages.
pubSubNoLocal boolean  Default(false) flag indicating whether to inhibit the delivery of messages published by its own connection.
receiveTimeout long Optional the timeout to use for receive calls (in milliseconds).
sessionAcknowledgeMode integer Optional the JMS acknowledgement mode that is used when creating a JMS Session to send a message
  • AUTO_ACKNOWLEDGE = 1
  • CLIENT_ACKNOWLEDGE = 2
  • DUPS_OK_ACKNOWLEDGE = 3
  • SESSION_TRANSACTED = 0
sessionAcknowledgeModeName String Optional
timeToLive long Optional the time-to-live of the message when sending.
Sample Usage - Spring XML
<!-- jmsSampleProducer is a bean definition of component -->
<bean id="jmsSampleProducer" class="org.ikasan.component.endpoint.jms.spring.producer.JmsTemplateProducer">
    <property name="configuration">
        <bean class="org.ikasan.component.endpoint.jms.spring.producer.SpringMessageProducerConfiguration">
            <property name="destinationJndiName" value="java:jboss/exported/jms/topic/test.file"/>
            <property name="connectionFactoryName" value="java:/JmsXA"/>
            <property name="pubSubDomain" value="true"/>
            <property name="deliveryPersistent" value="true"/>
            <property name="sessionTransacted" value="true"/>
        </bean>
    </property>
    <property name="configuredResourceId" value="jmsSampleProducer"/>
</bean>

<!-- jmsSampleProducerFlowElement is a bean definition of flow elements which uses jmsSampleProducer as a component -->
<bean id="jmsSampleProducerFlowElement" class="org.ikasan.builder.FlowElementFactory">
    <property name="name" value="JMS Producer"/>
    <property name="component"  ref="jmsSampleProducer"/>
</bean>
Sample Usage - builder pattern
public class ModuleConfig {


  @Resource
  private BuilderFactory builderFactory;

  public Producer getJmsProducer(){


    Producer jmsProducer = builderFactory.getComponentBuilder().jmsProducer()
       .setConnectionFactoryName("java:/JmsXA")
       .setDestinationJndiName("java:jboss/exported/jms/topic/test.target")
       .setDeliveryPersistent(true)
       .setPubSubDomain(true)
       .setSessionTransacted(true)
       .setConfiguredResourceId("jmsProducer")
       .build();
    return jmsProducer;
  }
}

(S)FTP Producer

This producer allows delivery of a file to remote (S)FTP server. The producer is under pined with persistent store which saves meta information about the deliver files.

Configuration Options
Option Type Purpose
clientId String clientId is stored as part of the meta information persisted about the processed file. The clientId should be a unique value identifing producer or consumer connecting to remote server.
cleanupJournalOnComplete boolean Default(true) Existing (S)FTP producer is using DB persistence tables to establish different operations it is performing as part of the command pattern (FileDiscovery, FileRename, FileDelivery). That persistent information is be default cleaned up when cleanupJournalOnComplete=true. It can be occasionally useful to cleanupJournalOnComplete=false when performing some debugging.
remoteHost String Default(‘localhost’) host name of the remote (S)FTP server where producer needs to connect.
remotePort integer Default(22) port of the remote (S)FTP server where producer needs to connect.
username String User name used to login to (S)FTP server where producer needs to connect.
password String password used to login to (S)FTP server where producer needs to connect. Takes precedences over privateKeyFilename. If both provided user/password combination will be used to login rather then user/privateKeyFilename.
maxRetryAttempts integer Default(3) internal (S)FTP connector retry count.
connectionTimeout integer Default(60000) expressed in milliseconds. Internal (S)FTP connector connection timeout value.
outputDirectory String Remote directory where to deliver the file
renameExtension String Default(‘tmp’) file delivery to remote location takes place in two stages, first a file is delivered with suffix equal to renameExtension, further file is renamed with suffix being removed.
tempFileName String
overwrite boolean Default(false) Flag indicating whether the remote file can be overwritten on remote server.
unzip boolean Default(false) Flag indicating whether the file should be unzipped on remote server as post delivery task. This makes an assumption that delivered stream is zipped.
checksumDelivered boolean Default(false) Flag indicating whether producer should generate and deliver a checksum md5 hash file to remote server.
createParentDirectory boolean Default(false) Flag indicating whether outputDirectory should be created if it does not exist.
cleanUpChunks boolean Default(trunk) Flag indicating whether chunk file information persisted in DB should be removed by producer after successful file delivery aka. successful file assembling from chunks.
privateKeyFilename String Optional only available on SFTP producer. Allows authentication to remote server with private/public key set given the exchange of the keys and connectivity setup were performed upfront.
knownHostsFilename String Optional only available on SFTP producer. Works in combination with private/public key set.
preferredKeyExchangeAlgorithm String Optional only available on SFTP producer. Allowing to explicitly provide KeyExchange Algorithm used by the remote server.
active boolean Optional only available on FTP producer. Default(False) Flag indicating whether the FTP connection is active or passive
dataTimeout integer Optional only available on FTP producer. Default(300000) expressed in milliseconds. Internal FTP connector data connection timeout value.
socketTimeout integer Optional only available on FTP producer. Default(300000) expressed in milliseconds. Internal FTP connector socket connection timeout value.
systemKey String Optional only available on FTP producer.
Sample Usage - builder pattern
public class ModuleConfig {


  @Resource
  private BuilderFactory builderFactory;

  public Producer getSftpProducer(){


    Producer sftpProducer = componentBuilder.sftpProducer()
       .setClientID(sftpProducerClientID)
       .setUsername(sftpProducerUsername)
       .setPassword(sftpProducerPassword)
       .setRemoteHost(sftpProducerRemoteHost)
       .setRemotePort(sftpProducerRemotePort)
       .setOutputDirectory(sftpConsumerOutputDirectory)
       .setConfiguredResourceId("sftpProducerConfiguration")
       .build();
    return sftpProducer;
  }
}