Skip to content

Commit

Permalink
[nats] Add maxBytes to config
Browse files Browse the repository at this point in the history
so one can prevent NATS running out of memory incase the storage type is set to "Memory"
  • Loading branch information
kevin-ip committed Feb 22, 2023
1 parent 1ff73a0 commit bd56d9c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public CompletableFuture<Void> createTopic(String topic, int partitions) {
.name(topic)
.subjects(topic)
.storageType(config.storageType)
.maxBytes(config.maxBytes)
.replicas(config.replicationFactor)
.build());
log.info("Created stream {} -- {}", topic, JsonUtils.getFormatted(streamInfo));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ public class NatsConfig {
public int replicationFactor;

public StorageType storageType = StorageType.File;

// -1 is unlimited
public int maxBytes = -1;
}

0 comments on commit bd56d9c

Please sign in to comment.