Uploaded image for project: 'AMQ Clients'
  1. AMQ Clients
  2. ENTMQCL-2972

[j2] Cannot specify other custom ClientOptions while still letting the library to generate random client ID

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • 2.11.0.GA
    • protonj2
    • None
    • False
    • False

      In the code below, connClientId is taken from client configuration. It may be explicitly set, or it may be unset, i.e. null. I want to create ProtonJ2 client and use the client id when it was specified.

      The following does not work. When connClientId is null, I get exception from ProtonJ2 that the parameter may not be null.

      ClientOptions clientOptions = new ClientOptions();
      if (connClientId != null) {
          clientOptions.id(connClientId);
      }
      
      Client client = Client.create(clientOptions);
      
      Objects.requireNonNull(options.id(), "User supplied container Id must be non-null");
      

      This is slightly inconvenient. Furthermore, it means that I am not able to set other client options (besides the id) and have ProtonJ2 generate a random ID for me. As far as I can tell, there is no recommendation for suitable method for generating random ID myself.

              rhn-support-tbish Tim Bish
              jdanek@redhat.com Jiri Daněk
              Jiri Daněk Jiri Daněk
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: