Add cloud-stream module: Spring Cloud Stream 5.1 on Boot 4.2 with Kafka and RabbitMQ binders
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5uEyg58znuchZ8C8i
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
e54cf840fd
commit
e2c42dc268
@@ -0,0 +1,36 @@
|
||||
package com.ankurm.cloudstream;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Collects lines and writes them to output/NN-name.txt when closed. Tests assert the same values
|
||||
* they print, so every number in the article is an assertion that fails the build when it stops being true.
|
||||
*/
|
||||
public final class Transcript implements AutoCloseable {
|
||||
|
||||
private final Path file;
|
||||
private final List<String> lines = new ArrayList<>();
|
||||
|
||||
public Transcript(String name) {
|
||||
this.file = Path.of(System.getProperty("user.dir"), "output", name + ".txt");
|
||||
}
|
||||
|
||||
public Transcript line(String format, Object... args) {
|
||||
lines.add(args.length == 0 ? format : String.format(format, args));
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
try {
|
||||
Files.createDirectories(file.getParent());
|
||||
Files.write(file, lines);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user