PublisherFactory returns PublisherInterface instead of Publisher
See original GitHub issueDescribe the bug
There was a change in the PublisherFactory in com.google.cloud:spring-cloud-gcp-pubsub
version 2.0.6 used in com.google.cloud:spring-cloud-gcp-starter-pubsub
which caused one of our applications to have a compilation error on the following line:
pubsubTemplate.getPublisherFactory.createPublisher(topic).publishAllOutstanding()
The reason for this is as follows:
In version 2.0.5 the PublisherFactory returns a Publisher
public interface PublisherFactory {
Publisher createPublisher(String topic);
}
while in v 2.0.6 it returns a PublisherInterface
public interface PublisherFactory {
PublisherInterface createPublisher(String topic);
}
The PublisherInterface doesn’t expose the Publisher method publishAllOutstanding()
.
This change is not mentioned in the change log for (release 2.0.6)[https://github.com/GoogleCloudPlatform/spring-cloud-gcp/releases/tag/v2.0.6].
The change was part of PR #548.
In this change I notice that the CachingPublisherFactory
implementation of PublisherFactory was also change to return a PublisherInterface instead of a Publisher, but the DefaultPublisherFactory
was not (and still returns a Publisher).
Since this isn’t mentioned in the release notes, I wonder if this change was intentional? ~And also whether we can fix our compilation error by casting to a DefaultPublisherFactory
going forward, or~ should assume that the publishAllOutstanding()
is not intended to be exposed (as it’s not part of the PublisherInterface).
Update: casting to DefaultPublisherFactory didn’t work.
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (7 by maintainers)
Top GitHub Comments
I’ve filed googleapis/java-pubsub#949 in the client library – if it’s meant to be a public surface, we should support it. If not, the downcasting workaround is fine.
It’s correct that most health indicators are enabled by default, but they should not be tied to Liveness group, which is what controls the Kubernetes restarts. So somehow these custom informational indicators are making their way to
management.endpoint.health.group.liveness.include
.