Hi George,

I tried to implement publisher on the my Server code (GAE). It worked. But 
it stop publishing any message today. I use pub/sub client code similar 
with example code in https://cloud.google.com/pubsub/docs/publisher. 

If I publish message through https://console.cloud.google.com on the topic, 
my client can receive the message without any problem.

Are there any issue with the publish code?

public static void publish(String message) throws Exception {

TopicName topicName = TopicName.of(projectId, topicId);


Publisher publisher = null;
List<ApiFuture<String>> messageIdFutures = new ArrayList<>();

try {
    publisher = Publisher.newBuilder(topicName).build();
    ByteString data = ByteString.copyFromUtf8(message);
    PubsubMessage pubsubMessage = 
PubsubMessage.newBuilder().setData(data).build();
    ApiFuture<String> messageIdFuture = publisher.publish(pubsubMessage);
    messageIdFutures.add(messageIdFuture);
}finally {
    List<String> messageIds = ApiFutures.allAsList(messageIdFutures).get();
    for (String messageId : messageIds) {
        System.out.println("published with message ID: " + messageId);

    }
    if (publisher != null) {
        // When finished with the publisher, shutdown to free up resources.
        publisher.shutdown();
    }

}


Thanks


On Monday, January 29, 2018 at 5:26:52 PM UTC-6, George (Cloud Platform 
Support) wrote:
>
> Hello Juan, 
>
> You may choose to implement a topic, and have your daemon application 
> subscribe to it. Google Cloud Pub/Sub 
> <https://cloud.google.com/pubsub/docs/> provides reliable, many-to-many, 
> asynchronous messaging between applications. Publisher applications can 
> send messages to a *topic*, and other applications can subscribe to that 
> topic to receive the messages. You may find more detail in the "Writing 
> and Responding to Pub/Sub Messages" online document 
> <https://cloud.google.com/appengine/docs/flexible/python/writing-and-responding-to-pub-sub-messages>
> . 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/99827f9e-95e0-4ac3-b553-e8d8a74e29a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to