I am following the shopping cart example. I am wondering if it is possible to specify the http response status code like 200 or 204. If it is possible, how? Should I specify that in protobuf or is it in the business logic? ( I’m using java)
We have this feature in the pipeline, but it has not been released yet. As a first step you will be able to set the HTTP status code by setting a custom metadata field with a name like
_akkasls-http-code (the specific name might still change). Further in the future we’d like to add some more ‘friendly’ API to do the same.
Once released, would that work for your scenario?
yes, it will totally help with my use case. So what you actually said is that in the current version I cannot change the status code and have to wait for the next update?
That’s indeed what I said, but the good news is that the version that allows this should now be deployed to https://console.kalix.io. As this is fairly hot-off-the-press this isn’t completely tested and documented yet, but if you’re feeling adventurous you could give it a try right now!
It would look something like this:
return effects().reply(responseObject, Metadata.EMPTY.add("_kalix-http-code", "418"));