Skip to content

Commit

Permalink
[TUBEMQ-441]An error occurred when using the Tubemq class to create a…
Browse files Browse the repository at this point in the history
… sink table (#339)

Co-authored-by: gosonzhang <gosonzhang@tencent.com>
  • Loading branch information
gosonzhang and gosonzhang committed Dec 4, 2020
1 parent 2e9e814 commit 288a2e3
Showing 1 changed file with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
*/
public class Tubemq extends ConnectorDescriptor {

@Nullable
private boolean consumerRole = true;

@Nullable
private String topic;

Expand Down Expand Up @@ -73,6 +76,16 @@ public Tubemq topic(String topic) {
return this;
}

/**
* Sets the client role to be used.
*
* @param isConsumer The client role if consumer.
*/
public Tubemq asConsumer(boolean isConsumer) {
this.consumerRole = isConsumer;
return this;
}

/**
* Sets the address of tubemq master to connect.
*
Expand Down Expand Up @@ -133,13 +146,14 @@ protected Map<String, String> toConnectorProperties() {
if (master != null) {
descriptorProperties.putString(CONNECTOR_MASTER, master);
}

if (group != null) {
descriptorProperties.putString(CONNECTOR_GROUP, group);
}

if (tids != null) {
descriptorProperties.putString(CONNECTOR_TIDS, tids);
if (consumerRole) {
if (group != null) {
descriptorProperties.putString(CONNECTOR_GROUP, group);
}

if (tids != null) {
descriptorProperties.putString(CONNECTOR_TIDS, tids);
}
}

descriptorProperties.putPropertiesWithPrefix(CONNECTOR_PROPERTIES, properties);
Expand Down

0 comments on commit 288a2e3

Please sign in to comment.