You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Alexander A <an...@gmail.com> on 2021/09/01 07:57:12 UTC

Camel QuickFix sessions start problem

Hi!

I have 2 camel routes from quickfix consumers.
Camel version is 3.4.4 but behaviour is the same with greater versions too.
2 sessions are described in fix.properties file.
Second route is .autoStartup(false).

When camel starts a quickfix consumer for the active route, it starts
second quickfix session (for disabled route) too.

This happens in org.apache.camel.component.quickfixj.doStart()
-> quickfix.SocketInitiator

private void initialize() throws ConfigError {
        if (isStarted.equals(Boolean.FALSE)) {
            eventHandlingStrategy.setExecutor(longLivedExecutor);
            createSessionInitiators();
            for (Session session : getSessionMap().values()) {
                Session.registerSession(session);
            }
            *startInitiators();*
            eventHandlingStrategy.blockInThread();
            isStarted = Boolean.TRUE;
        } else {
            log.warn("Ignored attempt to start already running
SocketInitiator.");
        }
    }

One possible workaround - store sessions in different files.

QuickFixJ approach for independen sessions startup described here:
https://stackoverflow.com/questions/61611047/how-to-manage-and-reload-multiple-quickfix-j-sessions-independently
.

How can I implement independent sessions startup with Camel using single
config file?


<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Без
вирусов. www.avast.ru
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>

Re: Camel QuickFix sessions start problem

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Ah okay this is more of an advanced problem and you would need to do
some custom coding or whatnot.
The nature of this seems that quickfix should be improved to have
independent configurations per session and then allow to only load the
configuration for which session is being started.

So at this point there is not something we can do in camel-quickfix.

On Sat, Sep 4, 2021 at 10:51 PM Claus Ibsen <cl...@gmail.com> wrote:
>
> Hi
>
> Ah okay maybe we can defer starting that quickfix till the route
> starts the consumer.
> Can you put together maybe a sample app or unit test, and create a
> JIRA and put your code there.
> That is a great start to look into this.
>
>
> On Wed, Sep 1, 2021 at 7:06 PM Alexander A <an...@gmail.com> wrote:
> >
> > Hi!
> >
> > I have 2 camel routes from quickfix consumers.
> > Camel version is 3.4.4 but behaviour is the same with greater versions too.
> > 2 sessions are described in fix.properties file.
> > Second route is .autoStartup(false).
> >
> > When camel starts a quickfix consumer for the active route, it starts
> > second quickfix session (for disabled route) too.
> >
> > This happens in org.apache.camel.component.quickfixj.doStart()
> > -> quickfix.SocketInitiator
> >
> > private void initialize() throws ConfigError {
> >         if (isStarted.equals(Boolean.FALSE)) {
> >             eventHandlingStrategy.setExecutor(longLivedExecutor);
> >             createSessionInitiators();
> >             for (Session session : getSessionMap().values()) {
> >                 Session.registerSession(session);
> >             }
> >             *startInitiators();*
> >             eventHandlingStrategy.blockInThread();
> >             isStarted = Boolean.TRUE;
> >         } else {
> >             log.warn("Ignored attempt to start already running
> > SocketInitiator.");
> >         }
> >     }
> >
> > One possible workaround - store sessions in different files.
> >
> > QuickFixJ approach for independen sessions startup described here:
> > https://stackoverflow.com/questions/61611047/how-to-manage-and-reload-multiple-quickfix-j-sessions-independently
> > .
> >
> > How can I implement independent sessions startup with Camel using single
> > config file?
> >
> >
> > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> > Без
> > вирусов. www.avast.ru
> > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Camel QuickFix sessions start problem

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Ah okay maybe we can defer starting that quickfix till the route
starts the consumer.
Can you put together maybe a sample app or unit test, and create a
JIRA and put your code there.
That is a great start to look into this.


On Wed, Sep 1, 2021 at 7:06 PM Alexander A <an...@gmail.com> wrote:
>
> Hi!
>
> I have 2 camel routes from quickfix consumers.
> Camel version is 3.4.4 but behaviour is the same with greater versions too.
> 2 sessions are described in fix.properties file.
> Second route is .autoStartup(false).
>
> When camel starts a quickfix consumer for the active route, it starts
> second quickfix session (for disabled route) too.
>
> This happens in org.apache.camel.component.quickfixj.doStart()
> -> quickfix.SocketInitiator
>
> private void initialize() throws ConfigError {
>         if (isStarted.equals(Boolean.FALSE)) {
>             eventHandlingStrategy.setExecutor(longLivedExecutor);
>             createSessionInitiators();
>             for (Session session : getSessionMap().values()) {
>                 Session.registerSession(session);
>             }
>             *startInitiators();*
>             eventHandlingStrategy.blockInThread();
>             isStarted = Boolean.TRUE;
>         } else {
>             log.warn("Ignored attempt to start already running
> SocketInitiator.");
>         }
>     }
>
> One possible workaround - store sessions in different files.
>
> QuickFixJ approach for independen sessions startup described here:
> https://stackoverflow.com/questions/61611047/how-to-manage-and-reload-multiple-quickfix-j-sessions-independently
> .
>
> How can I implement independent sessions startup with Camel using single
> config file?
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> Без
> вирусов. www.avast.ru
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2