camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Quickfix
Date Sun, 03 Oct 2010 20:24:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/Quickfix">Quickfix</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~svc-apache@stevebate.net">Steve
Bate</a>
    </h4>
        <br/>
                         <h4>Changes (10)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-changed-lines" >h2. <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Quickfix</span>
<span class="diff-added-words"style="background-color: #dfd;">QuickFIX/J</span>
Component <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br></td></tr>
            <tr><td class="diff-unchanged" >*Available as of Camel 2.0* <br>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">The
*quickfix* component is an implementation of the [QuickFix|http://www.quickfixj.org/] engine
for Java . This engine allows to connect to a FIX server which is used to exchange financial
messages according to [FIX protocol|http://www.fixprotocol.org/] standard.   <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">The
*quickfix* component adapts the [QuickFIX/J|http://www.quickfixj.org/] FIX engine for using
in Camel . This component uses the standard [Financial Interchange (FIX) protocol|http://www.fixprotocol.org/]
for message transport. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{info:title=Previous
Versions} <br>The *quickfix* component was rewritten for Camel 2.5. For information
about using the *quickfix* component prior to 2.5 see the documentation section below. <br>{info}
<br> <br></td></tr>
            <tr><td class="diff-unchanged" >Maven users will need to add the following
dependency to their {{pom.xml}} for this component: <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">h3.
URI format <br> <br>{code} <br>quickfix:configFile[?sessionID=sessionID]
<br>{code} <br> <br>The *configFile* is the name of the QuickFIX/J configuration
to use for the FIX engine (located as a resource found in your classpath). The optional sessionID
identifies a specific FIX session. The format of the sessionID is: <br> <br>{code}
<br>(BeginString):(SenderCompID)[/(SenderSubID)[/(SenderLocationID)]]-&gt;(TargetCompID)[/(TargetSubID)[/(TargetLocationID)]]
<br>{code} <br> <br>Example URIs: <br> <br>{code} <br>quickfix:config.cfg
<br> <br>quickfix:config.cfg?sessionID=FIX.4.2:MyTradingCompany-&gt;SomeExchange
<br>{code} <br> <br>h2. Endpoints <br> <br>FIX sessions are
endpoints for the *quickfix* component. An endpoint URI may specify a single session or all
sessions managed by a specific QuickFIX/J engine. Typical applications will use only one FIX
engine but advanced users may create multiple FIX engines by referencing different configuration
files in *quickfix* component endpoint URIs. <br> <br>When a consumer does not
include a session ID in the endpoint URI, it will receive exchanges for all sessions managed
by the FIX engine associated with the configuration file specified in the URI. If a producer
does not specify a session in the endpoint URI then it must include the session-related fields
in the FIX message being sent. If a session is specified in the URI then the component will
automatically inject the session-related fields into the FIX message. <br> <br>h3.
Exchange Format <br> <br>The exchange headers include information to help with
exchange filtering, routing and other processing. The following headers are available: <br>
<br>|| Header Name || Description || <br>| EventCategory | One of {{AppMessageReceived}},
{{AppMessageSent}}, {{AdminMessageReceived}}, {{AdminMessageSent}}, {{SessionCreated}}, {{SessionLogon}},
{{SessionLogoff}}. See the {{QuickfixjEventCategory}} enum. | <br>| SessionID | The
FIX message SessionID | <br>| MessageType | The FIX MsgType tag value | <br>|
DataDictionary | Specifies a data dictionary to used for parsing an incoming message. Can
be an instance of a data dictionary or a resource path for a QuickFIX/J data dictionary file
| <br> <br>The DataDictionary header is useful if string messages are being received
and need to be parsed in a route. QuickFIX/J requires a data dictionary to parse certain types
of messages (with repeating groups, for example). By injecting a DataDictionary header in
the route after receiving a message string, the FIX engine can properly parse the data. <br>
<br>h3. QuickFIX/J Configuration Extensions <br> <br>When using QuickFIX/J
directly, one typically writes code to create instances of logging adapters, message stores
and communication connectors. The *quickfix* component will automatically create instances
of these classes based on information in the configuration file. It also provides defaults
for many of the common required settings and adds additional capabilities (like the ability
to activate JMX support). <br> <br>The following sections describe how the *quickfix*
component processes the QuickFIX/J configuration. For comprehensive information about QuickFIX/J
configuration, see the [QFJ user manual|http://www.quickfixj.org/quickfixj/usermanual/usage/configuration.html].
<br> <br>h4. Communication Connectors <br> <br>When the component
detects an initiator or acceptor session setting in the QuickFIX/J configuration file it will
automatically create the corresponding initiator and/or acceptor connector. These settings
can be in the default or in a specific session section of the configuration file. <br>
<br> <br>|| Session Setting || Component Action || <br>| {{ConnectionType=initiator}}
| Create an initiator connector | <br>| {{ConnectionType=acceptor}} | Create an acceptor
connector | <br> <br>The threading model for the QuickFIX/J session connectors
can also be specified. These settings affect all sessions in the configuration file and must
be placed in the settings default section. <br> <br>|| Default/Global Setting
|| Component Action || <br>| {{ThreadModel=ThreadPerConnector}} | Use {{SocketInitiator}}
or {{SocketAcceptor}} (default) | <br>| {{ThreadModel=ThreadPerSession}} | Use {{ThreadedSocketInitiator}}
or {{ThreadedSocketAcceptor}} | <br> <br>h4. Logging <br> <br>The
QuickFIX/J logger implementation can be specified by including the following settings in the
default section of the configuration file. The {{ScreenLog}} is the default if none of the
following settings are present in the configuration. It&#39;s an error to include settings
that imply more than one log implementation. <br> <br>|| Default/Global Setting
|| Component Action || <br>| {{ScreenLogShowEvents}} | Use a {{ScreenLog}} | <br>|
{{ScreenLogShowIncoming}} | Use a {{ScreenLog}} | <br>| {{ScreenLogShowOutgoing}} |
Use a {{ScreenLog}} | <br>| {{FileLogPath}} | Use a {{FileLog}} | <br>| {{JdbcDriver}}
| Use a {{JdbcLog}} | <br> <br>h4. Message Store <br> <br>The QuickFIX/J
message store implementation can be specified by including the following settings in the default
section of the configuration file. The {{MemoryStore}} is the default if none of the following
settings are present in the configuration. It&#39;s an error to include settings that
imply more than one message store implementation. <br> <br>|| Default/Global Setting
|| Component Action || <br>| {{JdbcDriver}} | Use a {{JdbcStore}} | <br>| {{FileStorePath}}
| Use a {{FileStore}} | <br>| {{SleepycatDatabaseDir}} | Use a {{SleepcatStore}} | <br>
<br>h4. JMX <br> <br>|| Default/Global Setting || Component Action || <br>|
{{UseJmx}} | if {{Y}}, then enable QuickFIX/J JMX | <br> <br>h4. Other Defaults
<br> <br>The component provides some default settings for what are normally required
settings in QuickFIX/J configuration files. {{SessionStartTime}} and {{SessionEndTime}} default
to &quot;00:00:00&quot;, meaning the session will not be automatically started and
stopped. The {{HeartBtInt}} (heartbeat interval) defaults to 30 seconds. <br> <br>h4.
Minimal Initiator Configuration Example <br> <br>{code} <br>[SESSION] <br>ConnectionType=initiator
<br>BeginString=FIX.4.4 <br>SenderCompID=YOUR_SENDER <br>TargetCompID=YOUR_TARGET
<br>{code} <br> <br>h3. Exception handling <br> <br>QuickFIX/J
behavior can be modified if certain exceptions are thrown during processing of a message.
If a {{RejectLogon}} exception is thrown while processing an incoming logon administrative
message, then the logon will be rejected. <br> <br>Normally, QuickFIX/J handles
the logon process automatically. However, sometimes an outgoing logon message must be modified
to include credentials required by a FIX counterparty. If the FIX logon message body is modified
when sending a logon message (EventCategory={{AdminMessageSent}} the modified message will
be sent to the counterparty. It is important that the outgoing logon message is being processed
_synchronously_. If it is processed asynchronously (on another thread), the FIX engine will
immediately send the unmodified outgoing message when it&#39;s callback method returns.
<br> <br>h3. FIX Sequence Number Management <br> <br>If an application
exception is thrown during _synchronous_ exchange processing, this will cause QuickFIX/J to
not increment incoming FIX message sequence numbers and will cause a resend of the counterparty
message. This FIX protocol behavior is primarily intended to handle _transport_ errors rather
than application errors. There are risks associated with using this mechanism to handle application
errors. The primary risk is that the message will repeatedly cause application errors each
time it&#39;s re-received. A better solution is to persist the incoming message (database,
JMS queue) immediately before processing it. This also allows the application to process messages
asynchronously without losing messages when errors occur. <br> <br>Although it&#39;s
possible to send messages to a FIX session before it&#39;s logged on (the messages will
be sent at logon time), it is usually a better practice to wait until the session is logged
on. This eliminates the required sequence number resynchronization steps at logon. Waiting
for session logon can be done by setting up a route that processes the {{SessionLogon}} event
category and signals the application to start sending messages. <br> <br>See the
FIX protocol specifications and the QuickFIX/J documentation for more details about FIX sequence
number management. <br> <br>h3. Route Examples <br> <br>Several examples
are included in the QuickFIX/J component source code (test subdirectories). One of these examples
implements a trival trade excecution simulation. The example defines an application component
that uses the URI scheme &quot;trade-executor&quot;. <br> <br>The following
route receives messages for the trade executor session and passes application messages to
the trade executor component. <br> <br>{code} <br>from(&quot;quickfix:examples/inprocess.cfg?sessionID=FIX.4.2:MARKET-&gt;TRADER&quot;).
<br>    filter(header(QuickfixjEndpoint.EVENT_CATEGORY_KEY).isEqualTo(QuickfixjEventCategory.AppMessageReceived)).
<br>    to(&quot;trade-executor:market&quot;); <br>{code} <br> <br>The
trade executor component generates messages that are routed back to the trade session. The
session ID must be set in the FIX message itself since no session ID is specified in the endpoint
URI. <br> <br> <br>{code} <br>from(&quot;trade-executor:market&quot;).to(&quot;quickfix:examples/inprocess.cfg&quot;);
<br>{code} <br> <br>The trader session consumes execution report messages
from the market and processes them. <br> <br>{code} <br>from(&quot;quickfix:examples/inprocess.cfg?sessionID=FIX.4.2:TRADER-&gt;MARKET&quot;).
<br>    filter(header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(MsgType.EXECUTION_REPORT)).
<br>    bean(new MyTradeExecutionProcessor()); <br>{code} <br> <br>h2.
QuickFIX/J Component Prior to Camel 2.5 <br> <br>*Available since Camel 2.0* <br>
<br>The *quickfix* component is an implementation of the [QuickFIX/J|http://www.quickfixj.org/]
engine for Java . This engine allows to connect to a FIX server which is used to exchange
financial messages according to [FIX protocol|http://www.fixprotocol.org/] standard. <br>
<br></td></tr>
            <tr><td class="diff-unchanged" >*Note:* The component can be used
to send/receives messages to a FIX server. <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >Where *config file* is the location
(in your classpath) of the quickfix configuration file used to configure the engine at the
startup. <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >*Note:* Information about parameters
available for quickfix can be found on <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">[QuickFixJ|http://www.quickfixj.org/quickfixj/usermanual/usage/configuration.html]</span>
<span class="diff-added-words"style="background-color: #dfd;">[QuickFIX/J|http://www.quickfixj.org/quickfixj/usermanual/usage/configuration.html]</span>
web site. <br></td></tr>
            <tr><td class="diff-unchanged" > <br>The quickfix-server endpoint
must be used to receive from FIX server FIX messages and quickfix-client endpoint in the case
that you want to send messages to a FIX gateway. <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">*Warning:*
You cannot use a quickfix engine to send or receive messages in both direction as the FIX
protocol handle logon/logout sessions with heartbeat messages which are send to verify if
the server or client is still alive in only one direction. <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h3. Exchange data format <br>
<br></td></tr>
            <tr><td class="diff-changed-lines" >The <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">QuickFixJ</span>
<span class="diff-added-words"style="background-color: #dfd;">QuickFIX/J</span>
engine is like CXF component a messaging bus using MINA as protocol layer to create the socket
connection with the FIX engine gateway. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" >When <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">QuickFixJ</span>
<span class="diff-added-words"style="background-color: #dfd;">QuickFIX/J</span>
engine receives a message, then it create a QuickFix.Message instance which is next received
by the camel endpoint. This object is a &#39;mapping object&#39; created from a FIX
message formatted initially as a collection of key value pairs data. You can use this object
or you can use the method &#39;toString&#39; to retrieve the original FIX message.
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>*Note:* Alternatively,
you can use [camel bindy dataformat|bindy] to transform the FIX message into your own java
POJO <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="Quickfix-QuickFIX%2FJComponent"></a>QuickFIX/J Component</h2>

<p><b>Available as of Camel 2.0</b></p>

<p>The <b>quickfix</b> component adapts the <a href="http://www.quickfixj.org/"
class="external-link" rel="nofollow">QuickFIX/J</a> FIX engine for using in Camel
. This component uses the standard <a href="http://www.fixprotocol.org/" class="external-link"
rel="nofollow">Financial Interchange (FIX) protocol</a> for message transport.</p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><b>Previous
Versions</b><br />The <b>quickfix</b> component was rewritten for
Camel 2.5. For information about using the <b>quickfix</b> component prior to
2.5 see the documentation section below.</td></tr></table></div>

<p>Maven users will need to add the following dependency to their <tt>pom.xml</tt>
for this component:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;dependency&gt;
    &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
    &lt;artifactId&gt;camel-quickfix&lt;/artifactId&gt;
    &lt;version&gt;x.x.x&lt;/version&gt;
    &lt;!-- use the same version as your Camel core version --&gt;
&lt;/dependency&gt;
</pre>
</div></div>

<h3><a name="Quickfix-URIformat"></a>URI format</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
quickfix:configFile[?sessionID=sessionID]
</pre>
</div></div>

<p>The <b>configFile</b> is the name of the QuickFIX/J configuration to
use for the FIX engine (located as a resource found in your classpath). The optional sessionID
identifies a specific FIX session. The format of the sessionID is:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
(BeginString):(SenderCompID)[/(SenderSubID)[/(SenderLocationID)]]-&gt;(TargetCompID)[/(TargetSubID)[/(TargetLocationID)]]
</pre>
</div></div>

<p>Example URIs:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
quickfix:config.cfg

quickfix:config.cfg?sessionID=FIX.4.2:MyTradingCompany-&gt;SomeExchange
</pre>
</div></div>

<h2><a name="Quickfix-Endpoints"></a>Endpoints</h2>

<p>FIX sessions are endpoints for the <b>quickfix</b> component. An endpoint
URI may specify a single session or all sessions managed by a specific QuickFIX/J engine.
Typical applications will use only one FIX engine but advanced users may create multiple FIX
engines by referencing different configuration files in <b>quickfix</b> component
endpoint URIs.</p>

<p>When a consumer does not include a session ID in the endpoint URI, it will receive
exchanges for all sessions managed by the FIX engine associated with the configuration file
specified in the URI. If a producer does not specify a session in the endpoint URI then it
must include the session-related fields in the FIX message being sent. If a session is specified
in the URI then the component will automatically inject the session-related fields into the
FIX message.</p>

<h3><a name="Quickfix-ExchangeFormat"></a>Exchange Format</h3>

<p>The exchange headers include information to help with exchange filtering, routing
and other processing. The following headers are available:</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Header Name </th>
<th class='confluenceTh'> Description </th>
</tr>
<tr>
<td class='confluenceTd'> EventCategory </td>
<td class='confluenceTd'> One of <tt>AppMessageReceived</tt>, <tt>AppMessageSent</tt>,
<tt>AdminMessageReceived</tt>, <tt>AdminMessageSent</tt>, <tt>SessionCreated</tt>,
<tt>SessionLogon</tt>, <tt>SessionLogoff</tt>. See the <tt>QuickfixjEventCategory</tt>
enum. </td>
</tr>
<tr>
<td class='confluenceTd'> SessionID </td>
<td class='confluenceTd'> The FIX message SessionID </td>
</tr>
<tr>
<td class='confluenceTd'> MessageType </td>
<td class='confluenceTd'> The FIX MsgType tag value </td>
</tr>
<tr>
<td class='confluenceTd'> DataDictionary </td>
<td class='confluenceTd'> Specifies a data dictionary to used for parsing an incoming
message. Can be an instance of a data dictionary or a resource path for a QuickFIX/J data
dictionary file </td>
</tr>
</tbody></table>
</div>


<p>The DataDictionary header is useful if string messages are being received and need
to be parsed in a route. QuickFIX/J requires a data dictionary to parse certain types of messages
(with repeating groups, for example). By injecting a DataDictionary header in the route after
receiving a message string, the FIX engine can properly parse the data.</p>

<h3><a name="Quickfix-QuickFIX%2FJConfigurationExtensions"></a>QuickFIX/J
Configuration Extensions</h3>

<p>When using QuickFIX/J directly, one typically writes code to create instances of
logging adapters, message stores and communication connectors. The <b>quickfix</b>
component will automatically create instances of these classes based on information in the
configuration file. It also provides defaults for many of the common required settings and
adds additional capabilities (like the ability to activate JMX support).</p>

<p>The following sections describe how the <b>quickfix</b> component processes
the QuickFIX/J configuration. For comprehensive information about QuickFIX/J configuration,
see the <a href="http://www.quickfixj.org/quickfixj/usermanual/usage/configuration.html"
class="external-link" rel="nofollow">QFJ user manual</a>.</p>

<h4><a name="Quickfix-CommunicationConnectors"></a>Communication Connectors</h4>

<p>When the component detects an initiator or acceptor session setting in the QuickFIX/J
configuration file it will automatically create the corresponding initiator and/or acceptor
connector. These settings can be in the default or in a specific session section of the configuration
file.</p>


<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Session Setting </th>
<th class='confluenceTh'> Component Action </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>ConnectionType=initiator</tt> </td>
<td class='confluenceTd'> Create an initiator connector </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>ConnectionType=acceptor</tt> </td>
<td class='confluenceTd'> Create an acceptor connector </td>
</tr>
</tbody></table>
</div>


<p>The threading model for the QuickFIX/J session connectors can also be specified.
These settings affect all sessions in the configuration file and must be placed in the settings
default section.</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Default/Global Setting </th>
<th class='confluenceTh'> Component Action </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>ThreadModel=ThreadPerConnector</tt> </td>
<td class='confluenceTd'> Use <tt>SocketInitiator</tt> or <tt>SocketAcceptor</tt>
(default) </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>ThreadModel=ThreadPerSession</tt> </td>
<td class='confluenceTd'> Use <tt>ThreadedSocketInitiator</tt> or <tt>ThreadedSocketAcceptor</tt>
</td>
</tr>
</tbody></table>
</div>


<h4><a name="Quickfix-Logging"></a>Logging</h4>

<p>The QuickFIX/J logger implementation can be specified by including the following
settings in the default section of the configuration file. The <tt>ScreenLog</tt>
is the default if none of the following settings are present in the configuration. It's an
error to include settings that imply more than one log implementation.</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Default/Global Setting </th>
<th class='confluenceTh'> Component Action </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>ScreenLogShowEvents</tt> </td>
<td class='confluenceTd'> Use a <tt>ScreenLog</tt> </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>ScreenLogShowIncoming</tt> </td>
<td class='confluenceTd'> Use a <tt>ScreenLog</tt> </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>ScreenLogShowOutgoing</tt> </td>
<td class='confluenceTd'> Use a <tt>ScreenLog</tt> </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>FileLogPath</tt> </td>
<td class='confluenceTd'> Use a <tt>FileLog</tt> </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>JdbcDriver</tt> </td>
<td class='confluenceTd'> Use a <tt>JdbcLog</tt> </td>
</tr>
</tbody></table>
</div>


<h4><a name="Quickfix-MessageStore"></a>Message Store</h4>

<p>The QuickFIX/J message store implementation can be specified by including the following
settings in the default section of the configuration file. The <tt>MemoryStore</tt>
is the default if none of the following settings are present in the configuration. It's an
error to include settings that imply more than one message store implementation.</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Default/Global Setting </th>
<th class='confluenceTh'> Component Action </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>JdbcDriver</tt> </td>
<td class='confluenceTd'> Use a <tt>JdbcStore</tt> </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>FileStorePath</tt> </td>
<td class='confluenceTd'> Use a <tt>FileStore</tt> </td>
</tr>
<tr>
<td class='confluenceTd'> <tt>SleepycatDatabaseDir</tt> </td>
<td class='confluenceTd'> Use a <tt>SleepcatStore</tt> </td>
</tr>
</tbody></table>
</div>


<h4><a name="Quickfix-JMX"></a>JMX</h4>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Default/Global Setting </th>
<th class='confluenceTh'> Component Action </th>
</tr>
<tr>
<td class='confluenceTd'> <tt>UseJmx</tt> </td>
<td class='confluenceTd'> if <tt>Y</tt>, then enable QuickFIX/J JMX </td>
</tr>
</tbody></table>
</div>


<h4><a name="Quickfix-OtherDefaults"></a>Other Defaults</h4>

<p>The component provides some default settings for what are normally required settings
in QuickFIX/J configuration files. <tt>SessionStartTime</tt> and <tt>SessionEndTime</tt>
default to "00:00:00", meaning the session will not be automatically started and stopped.
The <tt>HeartBtInt</tt> (heartbeat interval) defaults to 30 seconds.</p>

<h4><a name="Quickfix-MinimalInitiatorConfigurationExample"></a>Minimal
Initiator Configuration Example</h4>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
[SESSION]
ConnectionType=initiator
BeginString=FIX.4.4
SenderCompID=YOUR_SENDER
TargetCompID=YOUR_TARGET
</pre>
</div></div>

<h3><a name="Quickfix-Exceptionhandling"></a>Exception handling</h3>

<p>QuickFIX/J behavior can be modified if certain exceptions are thrown during processing
of a message. If a <tt>RejectLogon</tt> exception is thrown while processing an
incoming logon administrative message, then the logon will be rejected.</p>

<p>Normally, QuickFIX/J handles the logon process automatically. However, sometimes
an outgoing logon message must be modified to include credentials required by a FIX counterparty.
If the FIX logon message body is modified when sending a logon message (EventCategory=<tt>AdminMessageSent</tt>
the modified message will be sent to the counterparty. It is important that the outgoing logon
message is being processed <em>synchronously</em>. If it is processed asynchronously
(on another thread), the FIX engine will immediately send the unmodified outgoing message
when it's callback method returns.</p>

<h3><a name="Quickfix-FIXSequenceNumberManagement"></a>FIX Sequence Number
Management</h3>

<p>If an application exception is thrown during <em>synchronous</em> exchange
processing, this will cause QuickFIX/J to not increment incoming FIX message sequence numbers
and will cause a resend of the counterparty message. This FIX protocol behavior is primarily
intended to handle <em>transport</em> errors rather than application errors. There
are risks associated with using this mechanism to handle application errors. The primary risk
is that the message will repeatedly cause application errors each time it's re-received. A
better solution is to persist the incoming message (database, JMS queue) immediately before
processing it. This also allows the application to process messages asynchronously without
losing messages when errors occur.</p>

<p>Although it's possible to send messages to a FIX session before it's logged on (the
messages will be sent at logon time), it is usually a better practice to wait until the session
is logged on. This eliminates the required sequence number resynchronization steps at logon.
Waiting for session logon can be done by setting up a route that processes the <tt>SessionLogon</tt>
event category and signals the application to start sending messages.</p>

<p>See the FIX protocol specifications and the QuickFIX/J documentation for more details
about FIX sequence number management.</p>

<h3><a name="Quickfix-RouteExamples"></a>Route Examples</h3>

<p>Several examples are included in the QuickFIX/J component source code (test subdirectories).
One of these examples implements a trival trade excecution simulation. The example defines
an application component that uses the URI scheme "trade-executor".</p>

<p>The following route receives messages for the trade executor session and passes application
messages to the trade executor component.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"quickfix:examples/inprocess.cfg?sessionID=FIX.4.2:MARKET-&gt;TRADER"</span>).
    filter(header(QuickfixjEndpoint.EVENT_CATEGORY_KEY).isEqualTo(QuickfixjEventCategory.AppMessageReceived)).
    to(<span class="code-quote">"trade-executor:market"</span>);
</pre>
</div></div>

<p>The trade executor component generates messages that are routed back to the trade
session. The session ID must be set in the FIX message itself since no session ID is specified
in the endpoint URI.</p>


<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"trade-executor:market"</span>).to(<span class="code-quote">"quickfix:examples/inprocess.cfg"</span>);
</pre>
</div></div>

<p>The trader session consumes execution report messages from the market and processes
them.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
from(<span class="code-quote">"quickfix:examples/inprocess.cfg?sessionID=FIX.4.2:TRADER-&gt;MARKET"</span>).
    filter(header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(MsgType.EXECUTION_REPORT)).
    bean(<span class="code-keyword">new</span> MyTradeExecutionProcessor());
</pre>
</div></div>

<h2><a name="Quickfix-QuickFIX%2FJComponentPriortoCamel2.5"></a>QuickFIX/J
Component Prior to Camel 2.5</h2>

<p><b>Available since Camel 2.0</b></p>

<p>The <b>quickfix</b> component is an implementation of the <a href="http://www.quickfixj.org/"
class="external-link" rel="nofollow">QuickFIX/J</a> engine for Java . This engine
allows to connect to a FIX server which is used to exchange financial messages according to
<a href="http://www.fixprotocol.org/" class="external-link" rel="nofollow">FIX protocol</a>
standard.</p>

<p><b>Note:</b> The component can be used to send/receives messages to a
FIX server.</p>

<h3><a name="Quickfix-URIformat"></a>URI format</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
quickfix-server:config file
quickfix-client:config file
</pre>
</div></div>

<p>Where <b>config file</b> is the location (in your classpath) of the quickfix
configuration file used to configure the engine at the startup.</p>

<p><b>Note:</b> Information about parameters available for quickfix can
be found on <a href="http://www.quickfixj.org/quickfixj/usermanual/usage/configuration.html"
class="external-link" rel="nofollow">QuickFIX/J</a> web site.</p>

<p>The quickfix-server endpoint must be used to receive from FIX server FIX messages
and quickfix-client endpoint in the case that you want to send messages to a FIX gateway.</p>

<h3><a name="Quickfix-Exchangedataformat"></a>Exchange data format</h3>

<p>The QuickFIX/J engine is like CXF component a messaging bus using MINA as protocol
layer to create the socket connection with the FIX engine gateway.</p>

<p>When QuickFIX/J engine receives a message, then it create a QuickFix.Message instance
which is next received by the camel endpoint. This object is a 'mapping object' created from
a FIX message formatted initially as a collection of key value pairs data. You can use this
object or you can use the method 'toString' to retrieve the original FIX message.</p>

<p><b>Note:</b> Alternatively, you can use <a href="/confluence/display/CAMEL/Bindy"
title="Bindy">camel bindy dataformat</a> to transform the FIX message into your own
java POJO</p>

<p>When a message must be send to QuickFix, then you must create a QuickFix.Message
instance.</p>

<h3><a name="Quickfix-Samples"></a>Samples</h3>

<p>Direction : to FIX gateway</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;route&gt;
&lt;from uri=<span class="code-quote">"activemq:queue:fix"</span>/&gt;
&lt;bean ref=<span class="code-quote">"fixService"</span> method=<span
class="code-quote">"createFixMessage"</span> /&gt; <span class="code-comment">//
bean method in charge to transform message into a QuickFix.Message
</span>&lt;to uri=<span class="code-quote">"quickfix-client:META-INF/quickfix/client.cfg"</span>
/&gt; <span class="code-comment">// Quickfix engine who will send the FIX messages
to the gateway</span>
</pre>
</div></div>

<p>Direction : from FIX gateway</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&lt;from uri=<span class="code-quote">"quickfix-server:META-INF/quickfix/server.cfg"</span>/&gt;
<span class="code-comment">// QuickFix engine who will receive the message from FIX
gateway
</span>&lt;bean ref=<span class="code-quote">"fixService"</span> method=<span
class="code-quote">"parseFixMessage"</span> /&gt; <span class="code-comment">//
bean method parsing the QuickFix.Message
</span>&lt;to uri=<span class="code-quote">"uri="</span>activemq:queue:fix<span
class="code-quote">"/&gt;"</span> /&gt;
</pre>
</div></div>

<h3><a name="Quickfix-SeeAlso"></a>See Also</h3>
<ul>
	<li><a href="/confluence/display/CAMEL/Configuring+Camel" title="Configuring Camel">Configuring
Camel</a></li>
	<li><a href="/confluence/display/CAMEL/Component" title="Component">Component</a></li>
	<li><a href="/confluence/display/CAMEL/Endpoint" title="Endpoint">Endpoint</a></li>
	<li><a href="/confluence/display/CAMEL/Getting+Started" title="Getting Started">Getting
Started</a></li>
</ul>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Quickfix">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=5966095&revisedVersion=9&originalVersion=8">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Quickfix?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message