Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1316

Multiple Mongo Instances always have the same MongoOption Reference

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.10.1
    • Connection Management
    • Software
    • Fully Compatible

    Description

      Team,

      I'm trying to create two instance of Mongo with different MongoOptions as the need is to connect to two different database within the same mongo host but with different connection parameters.

      But only one instance of MongoOption is created and only one of the possible connection parameters are set as the other one gets overridden during the second Mongo instance initialization.

      Is there a way to create two different instances of MongoOptions?

      The configuration is given below.
      <mongo:mongo replica-set="${mongo.host}" id="apiMongo">
      <mongo:options connections-per-host="8"
      threads-allowed-to-block-for-connection-multiplier="2"
      connect-timeout="12000"
      max-wait-time="12000"
      auto-connect-retry="true"
      socket-keep-alive="true"
      socket-timeout="120000"
      />
      </mongo:mongo>

      <mongo:mongo replica-set="${mongo.host}" id="systemMongo">
      <mongo:options connections-per-host="8"
      threads-allowed-to-block-for-connection-multiplier="2"
      connect-timeout="2000"
      max-wait-time="2000"
      auto-connect-retry="true"
      socket-keep-alive="true"
      socket-timeout="2000"
      />
      </mongo:mongo>

      Two instances of Mongo is created and they both point to a single instance of MongoOptions. Is there a way to create multiple instances of MongoOption?

      Attachments

        Activity

          People

            Unassigned Unassigned
            enthusiast Sulbigar Shanawaz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: