Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-17741

Impossible to use the wildcard (*) operator in combination with "test-connection-in-pool" operation on (non)XA datasource

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • JCA
    • None

      According to EAP 7.4.X Management CLI guide it's possible to use the wildcard operator to query multiple resources.

      Specifically speaking (trying to query) (non)XA datasources, this seems to work for the read-resource() or read-attribute() operation(s), e.g.:

      • non-XA datasource case:
        [standalone@localhost:9990 /] /subsystem=datasources/data-source=*:read-attribute(name=jndi-name)
        /subsystem=datasources/data-source=*:read-attribute(name=jndi-name)
        {
            "outcome" => "success",
            "result" => [
                {
                    "address" => [
                        ("subsystem" => "datasources"),
                        ("data-source" => "sso_postgresqlObjectStorePool")
                    ],
                    "outcome" => "success",
                    "result" => "java:jboss/datasources/KeycloakDSObjectStore"
                },
                {
                    "address" => [
                        ("subsystem" => "datasources"),
                        ("data-source" => "ExampleDS")
                    ],
                    "outcome" => "success",
                    "result" => "java:jboss/datasources/ExampleDS"
                }
            ]
        }
        
      • XA datasource case:
      [standalone@localhost:9990 /] /subsystem=datasources/xa-data-source=*:read-attribute(name=jndi-name)
      /subsystem=datasources/xa-data-source=*:read-attribute(name=jndi-name)
      {
          "outcome" => "success",
          "result" => [{
              "address" => [
                  ("subsystem" => "datasources"),
                  ("xa-data-source" => "sso_postgresql-DB")
              ],
              "outcome" => "success",
              "result" => "java:jboss/datasources/KeycloakDS"
          }]
      }
      

      But doesn't work for the test-connection-in-pool() operation:

      • non-XA datasource case:
        [standalone@localhost:9990 /] /subsystem=datasources/data-source=*:test-connection-in-pool()
        /subsystem=datasources/data-source=*:test-connection-in-pool()
        {
            "outcome" => "failed",
            "failure-description" => "WFLYJCA0040: failed to invoke operation: WFLYJCA0042: failed to match pool. Check JndiName: *",
            "rolled-back" => true
        }
        
      • XA datasource case:
        [standalone@localhost:9990 /] /subsystem=datasources/xa-data-source=*:test-connection-in-pool()
        /subsystem=datasources/xa-data-source=*:test-connection-in-pool()
        {
            "outcome" => "failed",
            "failure-description" => "WFLYJCA0040: failed to invoke operation: WFLYJCA0042: failed to match pool. Check JndiName: *",
            "rolled-back" => true
        }
        

      How does the test-connection-in-pool() operation differs e.g. from the read-attribute() operation, when trying to use the wildcard? In others, suppose you want to check if it's possible to establish the connection for all the (non) XA datasource defined ATM.

      Currently, to do this, you need to perform two queries:
      1) First get the list of all defined (non) XA datasources,
      2) Then in a loop go one by one (using exact datasource name) and call the test-connection-in-pool() operation on them.

      Note: This was tested with jboss-cli.sh as present in JBoss EAP 7.4.8 version (behavior of latest Wildfly wasn't checked). If this functionality is already available in latest Wildfly, kindly consider backporting the feature (moving this Jira to the relevant project as appropriate) to EAP 7.4.X version too.

      Thanks,
      Jan

              Unassigned Unassigned
              rhn-jlieskov Ján Lieskovský (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: