File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -112,26 +112,26 @@ contents:
112112``` java
113113package com.example ;
114114
115- import com.example.PubSubBackground.PubSubMessage ;
116115import com.google.cloud.functions.BackgroundFunction ;
117116import com.google.cloud.functions.Context ;
118117import java.util.Map ;
119118import java.util.logging.Logger ;
120119
120+ // This is the Pub/Sub message format from the Pub/Sub emulator.
121+ class PubSubMessage {
122+ String data;
123+ Map<String , String > attributes;
124+ String messageId;
125+ String publishTime;
126+ }
127+
121128public class PubSubBackground implements BackgroundFunction<PubSubMessage > {
122129 private static final Logger logger =
123130 Logger . getLogger(PubSubBackground . class. getName());
124131
125132 @Override
126133 public void accept (PubSubMessage pubSubMessage , Context context ) {
127- logger. info(" Received message with id " + pubSubMessage. messageId);
128- }
129-
130- public static class PubSubMessage {
131- public String data;
132- public Map<String , String > attributes;
133- public String messageId;
134- public String publishTime;
134+ logger. info(" Received message with id " + context. eventId());
135135 }
136136}
137137```
You can’t perform that action at this time.
0 commit comments