Fix PubSubIT due to race in map. (#634)

This commit is contained in:
Artur Souza 2021-09-17 16:26:42 -07:00 committed by GitHub
parent addf6029c0
commit 680915e832
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ import java.util.function.BiFunction;
@RestController
public class SubscriberController {
private final Map<String, List<CloudEvent<?>>> messagesByTopic = new HashMap<>();
private final Map<String, List<CloudEvent<?>>> messagesByTopic = Collections.synchronizedMap(new HashMap<>());
@GetMapping(path = "/messages/{topic}")
public List<CloudEvent<?>> getMessagesByTopic(@PathVariable("topic") String topic) {