Alasivut
  • Example - Brad Harvey

Versiot verrattuina

Avain

  • Tämä rivit lisättiin.
  • Tämä rivi poistettiin.
  • Muotoilua muutettiin.
Kommentti: Migrated to Confluence 5.3

...

Here's the basic application context. You supply an Application implementation and quickfix will start up once the application context is loaded. Aside from your Application you also need sample.QuickFixBean which does most of the work.

Koodilohko
xml
xml
titlequickfixContext.xmlxml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-lazy-init="false" default-dependency-check="none" default-autowire="no">

	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name='locations'>
			<value>config.properties</value>
		</property>
		<!-- defaults - you can override this in config.properties or by specifying them as system properties -->
		<property name="properties">
			<props>
				<!-- path to sessions configuration file -->
				<prop key="quickfix.config">/path/to/quickfix.cfg</prop>
				<!-- true = initiator, false = acceptor.  Haven't actually tried as an acceptor. -->
				<prop key="session.client">true</prop>
				<!-- haven't tried threaded=true -->
				<prop key="session.threaded">false</prop>
			</props>
		</property>
	</bean>

	<!-- Change your.Application to your Application class -->
    <bean id='application'
        class='your.Application'>
    </bean>

    <bean id='sessionSettings' class='quickfix.SessionSettings'>
        <constructor-arg><value>${quickfix.config}</value></constructor-arg>
    </bean>

    <bean id='quickfix' class='sample.QuickFixBean'>
        <property name='application'><ref bean = 'application'/></property>
        <property name='sessionSettings'><ref bean='sessionSettings'/></property>
        <property name='client'><value>${session.client}</value></property>
        <property name='threaded'><value>${session.threaded}</value></property>
        <property name='logFactory'><ref bean='logFactory'/></property>
        <property name='messageStoreFactory'><ref bean='messageStoreFactory'/></property>
    </bean>

    <bean id='logFactory' class='quickfix.SLF4JLogFactory'>
        <constructor-arg><ref bean='sessionSettings'/></constructor-arg>
    </bean>

    <bean id='messageStoreFactory' class='quickfix.FileStoreFactory'>
        <constructor-arg><ref bean='sessionSettings'/></constructor-arg>
    </bean>
</beans>

...