Skip to content

Commit

Permalink
DBZ-7909 Make legay options optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jpechane committed Oct 9, 2024
1 parent 5989802 commit 0158644
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public class RabbitMqStreamNativeChangeConsumer extends BaseChangeConsumer imple

@Deprecated
@ConfigProperty(name = PROP_PREFIX + "connection.host")
String legacyHost;
Optional<String> legacyHost;

@Deprecated
@ConfigProperty(name = PROP_PREFIX + "connection.port")
int legacyPort;
Optional<Integer> legacyPort;

@ConfigProperty(name = PROP_PREFIX + "host", defaultValue = "localhost")
String host;
Expand Down Expand Up @@ -145,12 +145,12 @@ private void createStream(Environment env, String name) {

@PostConstruct
void connect() {
if (legacyHost != null || legacyPort > 0) {
if (legacyHost.isPresent() || legacyPort.isPresent()) {
LOGGER.warn("The parameters connection.host and connection.port are deprecated, please use rabbitmqstream.host and rabbitmqstream.port moving forward.");
}

String connectionHost = legacyHost != null ? legacyHost : host;
int connectionPort = legacyPort > 0 ? legacyPort : port;
final String connectionHost = legacyHost.orElse(host);
final int connectionPort = legacyPort.orElse(port);

LOGGER.info("Using connection to {}:{}", connectionHost, connectionPort);

Expand Down

0 comments on commit 0158644

Please sign in to comment.