You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When direct invoking the reserve method, we input values, we get the mentioned exception trace. This does not happen during a postman call. It seems to be occuring by how the direct invoke input is being captured:
Controller Method:
@RestController
public class MockConcertController {
private final Random random = new Random();
@PostMapping("integration/splitter/concert/reserve")
public Flux<ConcertReservationResponse> reserve(@RequestBody Flux<ConcertReservationRequest> requestFlux) {
return requestFlux.flatMap(request -> {
int randomPrice = calculateRandomPrice(request.getSlot());
ConcertReservationResponse response = ConcertReservationResponse.create(
UUID.randomUUID(),
request.getCity(),
request.getSlot(),
request.getCategory(),
randomPrice
);
return Mono.just(response);
});
}
private int calculateRandomPrice(LocalDateTime slot) {
// Add randomness
int basePrice = 100;
int variation = random.nextInt(50);
return basePrice + variation;
}
}
Request Object
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor(staticName = "create")
public class ConcertReservationRequest {
private String city;
private LocalDateTime slot;
private String category;
}
Caused by: Cannot invoke "reactor.core.publisher.Flux.flatMap(java.util.function.Function)" because "requestFlux" is null
at org.unlogged.springwebfluxdemo.integrationpatterns.splitter.externalservices.MockConcertController.reserve(MockConcertController.java:22)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:568)
at io.unlogged.AgentCommandExecutorImpl.lambda$executeCommandRaw$0(AgentCommandExecutorImpl.java:346)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:45)
at reactor.core.publisher.Mono.subscribe(Mono.java:4512)
at reactor.core.publisher.Mono.subscribeWith(Mono.java:4578)
at reactor.core.publisher.Mono.subscribe(Mono.java:4339)
at io.unlogged.AgentCommandExecutorImpl.executeCommandRaw(AgentCommandExecutorImpl.java:379)
at io.unlogged.AgentCommandExecutorImpl.executeCommand(AgentCommandExecutorImpl.java:477)
at io.unlogged.command.AgentCommandServer.serve(AgentCommandServer.java:74)
at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)
at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)
at java.lang.Thread.run(Thread.java:840)
Reproduction steps
Direct invoke the given controller. method.
You will receive an exception.
With postman everything works fine
...
Expected behavior
Correct Expected json output as received in postman:
Describe the bug
When direct invoking the
reserve
method, we input values, we get the mentioned exception trace. This does not happen during a postman call. It seems to be occuring by how the direct invoke input is being captured:Controller Method:
Request Object
Response Object:
Exception Trace:
Reproduction steps
...
Expected behavior
Correct Expected json output as received in postman:
Additional context
No response
The text was updated successfully, but these errors were encountered: