Skip to content

throw exception in BaseBrokerStarter#getDefaultBrokerId() #10965

@mingmxu

Description

@mingmxu

brokerId is assigned as below:(code)

String brokerId = _brokerConf.getProperty(Broker.CONFIG_OF_BROKER_ID, getDefaultBrokerId());

A valid value for brokerId is important in many components, for example it's required in v2 engine to guarantee an unique requestId. It's preferred to throw an exception to stop broker starter instead of return an empty string.

  private String getDefaultBrokerId() {
    try {
      return InetAddress.getLocalHost().getHostName();
    } catch (Exception e) {
      LOGGER.error("Caught exception while getting default broker Id", e);
      return "";
    }
  }

cc @jackjlli

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions