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 passing in a null value in @MessageHeader parameter of a @PubSubCLient method I would expect a null value on the receiver side and not a "null" String literal.
Actual Behaviour
The receiver side has "null" String literal value instead of null
Steps To Reproduce
Send a message with by calling the below send method for example: client.send("message body goes here", null);
package micronaut.reproduce;
import com.google.pubsub.v1.PubsubMessage;
import io.micronaut.gcp.pubsub.annotation.Subscription;
import io.micronaut.messaging.Acknowledgement;
import io.micronaut.messaging.annotation.MessageBody;
import io.micronaut.messaging.annotation.MessageHeader;
import reactor.core.publisher.Mono;
@io.micronaut.gcp.pubsub.annotation.PubSubListener
public class PubSubListener {
@Subscription("topic-name")
Mono<Long> onMessage(
@MessageBody PubsubMessage messageBody,
@MessageHeader String route,
Acknowledgement ack
) {
// I need to add this null mapping to work properly and I think this is a bug
route = "null".equals(route) ? null : route;
// The issue manifests also when the value is extracted from the messageBody
var route2 = messageBody.getAttributesOrDefault("route", null);
route2 = "null".equals(route2) ? null : route2;
return Mono.empty();
}
}
Environment Information
JDK 21
Micronaut Parent version: 4.6.3
Example Application
No response
Version
4.6.3
The text was updated successfully, but these errors were encountered:
I suspect there is an issue with the client as both ways of reading the message header returns "null" String literal.
Also the version of listener works fine with the client that does not take (and therefore send) @MessageHeader("route") String route parameter.
Perhaps the header should be omitted by the client when the value is null (meaning it is not set)?
Expected Behavior
When passing in a null value in @MessageHeader parameter of a @PubSubCLient method I would expect a null value on the receiver side and not a "null" String literal.
Actual Behaviour
The receiver side has "null" String literal value instead of null
Steps To Reproduce
Send a message with by calling the below send method for example:
client.send("message body goes here", null);
Environment Information
JDK 21
Micronaut Parent version: 4.6.3
Example Application
No response
Version
4.6.3
The text was updated successfully, but these errors were encountered: