echo -n 3 | http -v :8080/foo;
+# tag::logicerror[]
+echo 17 | http -v :8080/foo?error=1
+# end::logicerror[]
+
# tag::kafkacat[]
kafkacat -b :9092 -t test -o 0 -e -f 'p=%p|o=%o|k=%k|h=%h|v=%s\n'
# end::kafkacat[]
public DeferredResult<ProduceResult> send(
@PathVariable String key,
@RequestHeader(name = "X-id", required = false) Long correlationId,
- @RequestBody Integer number)
+ @RequestBody Integer number,
+ @RequestParam(required = false) boolean error)
{
ResultRecorder result = new ResultRecorder(number+1);
for (int i = 1; i <= number; i++)
{
- send(key, new AddNumberMessage(number, i), correlationId, result);
+ int next = error && i == (number+1)/2 ? i * -1 : i;
+ send(key, new AddNumberMessage(number, next), correlationId, result);
}
send(key, new CalculateSumMessage(number), correlationId, result);