Camel
  1. Camel
  2. CAMEL-5480

QuickFix session logs in before Camel routes are started

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9.2
    • Fix Version/s: 2.9.4, 2.10.2, 2.11.0
    • Component/s: camel-quickfix
    • Labels:
      None
    • Environment:

      Spring 3.1.0

    • Estimated Complexity:
      Moderate

      Description

      To recreate the issue:

      1) Configure the Camel context to have autostart=false
      2) Create a route that processes the loggin message
      3) Refresh the Spring application context
      4) Start the Spring application context

      The QuickFixj engine will be created and started at step 3 but the route that processes the login message only gets started at step 4. If there are other components in the Spring application context that are slow to initialize then the QuickFixj engines will login before the Camel context (and hence the routes) have been started.

      This is an issue for us as we add a username and password to the login message using a Camel route.

      Proposed solution:
      Have the Dispatcher in the QuickFixjEngine extend ApplicationExtended and disable login until the CamelContext is started.

      Patch and test to follow.

        Activity

        Michael Horwitz created issue -
        Claus Ibsen made changes -
        Field Original Value New Value
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Fix Version/s 2.11.0 [ 12321695 ]
        Priority Major [ 3 ] Minor [ 4 ]
        Hide
        Claus Ibsen added a comment - - edited

        Should use org.apache.camel.StartupListener instead as its provided by Camel and dont depend on Spring etc.

        This is for example how we do with camel-quartz to defer starting the scheduler until Camel is fully started.

        Show
        Claus Ibsen added a comment - - edited Should use org.apache.camel.StartupListener instead as its provided by Camel and dont depend on Spring etc. This is for example how we do with camel-quartz to defer starting the scheduler until Camel is fully started.
        Hide
        Claus Ibsen added a comment -

        The enginens is now deferred started until CamelContext has been fully started, similar to what we do in camel-quartz.

        Show
        Claus Ibsen added a comment - The enginens is now deferred started until CamelContext has been fully started, similar to what we do in camel-quartz.
        Claus Ibsen made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Claus Ibsen [ davsclaus ]
        Fix Version/s 2.9.4 [ 12323142 ]
        Fix Version/s 2.10.2 [ 12323141 ]
        Resolution Fixed [ 1 ]
        Hide
        Michael Horwitz added a comment -

        I tested this in our environment and found a few issues:

        1. Inside the QuickFixJComponent engines are started when creating endpoints if the component is started. This happens before the Camel Context is fully started. Patch is attached.
        2. The StartupListener is called twice from inside the DefaultCamelContext when using deferred startup, the first time before the context is properly started. Should this be raised on the dev mailing list?
        Show
        Michael Horwitz added a comment - I tested this in our environment and found a few issues: Inside the QuickFixJComponent engines are started when creating endpoints if the component is started. This happens before the Camel Context is fully started. Patch is attached. The StartupListener is called twice from inside the DefaultCamelContext when using deferred startup, the first time before the context is properly started. Should this be raised on the dev mailing list?
        Michael Horwitz made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Estimated Complexity Unknown [ 10060 ] Moderate [ 10062 ]
        Hide
        Michael Horwitz added a comment -

        Patch to ensure engines are only started when both the Camel context and the QuickFixj component are started.

        Show
        Michael Horwitz added a comment - Patch to ensure engines are only started when both the Camel context and the QuickFixj component are started.
        Michael Horwitz made changes -
        Attachment camel_quickfix_startup_patch.patch [ 12543166 ]
        Hide
        Claus Ibsen added a comment -

        Thanks for spotting this.

        I adjusted the patch, to check the status on camel context, then there is no need for that boolean flag.

        Ad 2)
        Yeah if you can provided a little example then raise it on @dev or a new JIRA and we can take a look.

        Show
        Claus Ibsen added a comment - Thanks for spotting this. I adjusted the patch, to check the status on camel context, then there is no need for that boolean flag. Ad 2) Yeah if you can provided a little example then raise it on @dev or a new JIRA and we can take a look.
        Claus Ibsen made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Claus Ibsen
            Reporter:
            Michael Horwitz
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development