Skip to content

Commit

Permalink
DBZ-7909 Added deprecation message, with warnings and re-introduced o…
Browse files Browse the repository at this point in the history
…riginal host and port paramters
  • Loading branch information
zikphil authored and jpechane committed Oct 9, 2024
1 parent bcd9b0b commit 9bb5924
Showing 1 changed file with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ public class RabbitMqStreamNativeChangeConsumer extends BaseChangeConsumer imple

private static final String PROP_PREFIX = "debezium.sink.rabbitmqstream.";

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

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

@ConfigProperty(name = PROP_PREFIX + "host", defaultValue = "localhost")
String host;

Expand Down Expand Up @@ -137,10 +145,17 @@ private void createStream(Environment env, String name) {

@PostConstruct
void connect() {
LOGGER.info("Using connection to {}:{}", host, port);
if (legacyHost != null || legacyPort > 0) {
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;

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

try {
Address entryPoint = new Address(host, port);
Address entryPoint = new Address(connectionHost, connectionPort);
environment = Environment.builder()
.host(entryPoint.host())
.port(entryPoint.port())
Expand Down

0 comments on commit 9bb5924

Please sign in to comment.