Search in sources :

Example 1 with MemoryStoreFactory

use of quickfix.MemoryStoreFactory in project camel by apache.

the class QuickfixjComponentTest method setUpComponent.

private void setUpComponent(boolean injectQfjPlugins) throws IOException, MalformedURLException, NoSuchMethodException {
    camelContext = new DefaultCamelContext();
    component = new QuickfixjComponent();
    component.setCamelContext(camelContext);
    camelContext.addComponent("quickfix", component);
    if (injectQfjPlugins) {
        engineMessageFactory = new DefaultMessageFactory();
        engineMessageStoreFactory = new MemoryStoreFactory();
        engineLogFactory = new ScreenLogFactory();
        component.setMessageFactory(engineMessageFactory);
        component.setMessageStoreFactory(engineMessageStoreFactory);
        component.setLogFactory(engineLogFactory);
    }
    assertThat(component.getEngines().size(), is(0));
    Method converterMethod = QuickfixjConverters.class.getMethod("toSessionID", new Class<?>[] { String.class });
    camelContext.getTypeConverterRegistry().addTypeConverter(SessionID.class, String.class, new StaticMethodTypeConverter(converterMethod, false));
}
Also used : DefaultMessageFactory(quickfix.DefaultMessageFactory) MemoryStoreFactory(quickfix.MemoryStoreFactory) ScreenLogFactory(quickfix.ScreenLogFactory) Method(java.lang.reflect.Method) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) StaticMethodTypeConverter(org.apache.camel.impl.converter.StaticMethodTypeConverter)

Example 2 with MemoryStoreFactory

use of quickfix.MemoryStoreFactory in project camel by apache.

the class QuickfixjEngine method inferMessageStoreFactory.

private MessageStoreFactory inferMessageStoreFactory(SessionSettings settings) throws ConfigError {
    Set<MessageStoreFactory> impliedMessageStoreFactories = new HashSet<MessageStoreFactory>();
    isJdbcStore(settings, impliedMessageStoreFactories);
    isFileStore(settings, impliedMessageStoreFactories);
    isSleepycatStore(settings, impliedMessageStoreFactories);
    if (impliedMessageStoreFactories.size() > 1) {
        throw new ConfigError("Ambiguous message store implied in configuration.");
    }
    MessageStoreFactory messageStoreFactory;
    if (impliedMessageStoreFactories.size() == 1) {
        messageStoreFactory = impliedMessageStoreFactories.iterator().next();
    } else {
        messageStoreFactory = new MemoryStoreFactory();
    }
    LOG.info("Inferring message store factory: {}", messageStoreFactory.getClass().getName());
    return messageStoreFactory;
}
Also used : MemoryStoreFactory(quickfix.MemoryStoreFactory) ConfigError(quickfix.ConfigError) MessageStoreFactory(quickfix.MessageStoreFactory) HashSet(java.util.HashSet)

Aggregations

MemoryStoreFactory (quickfix.MemoryStoreFactory)2 Method (java.lang.reflect.Method)1 HashSet (java.util.HashSet)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1 StaticMethodTypeConverter (org.apache.camel.impl.converter.StaticMethodTypeConverter)1 ConfigError (quickfix.ConfigError)1 DefaultMessageFactory (quickfix.DefaultMessageFactory)1 MessageStoreFactory (quickfix.MessageStoreFactory)1 ScreenLogFactory (quickfix.ScreenLogFactory)1