com.turbospaces.gcp.pubsub.PubsubTopic Maven / Gradle / Ivy
package com.turbospaces.gcp.pubsub;
import com.turbospaces.api.Topic;
import com.turbospaces.cfg.ApplicationProperties;
public interface PubsubTopic extends Topic {
default boolean withCustomAckDeadline() {
return true;
}
default boolean withCustomConfiguration() {
return false;
}
default boolean isResponseTopic() {
return false;
}
default boolean deliverToAllSubscribers() {
return false;
}
default String subscriptionName(ApplicationProperties props) {
String appId = props.CLOUD_APP_ID.get();
String slot = props.CLOUD_APP_INSTANCE_INDEX.get();
String topicName = name().toString();
return deliverToAllSubscribers() ? String.format("%s-%s-%s", topicName, appId, slot) : String.format("%s-%s", topicName, appId);
}
}