Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[hono-dev] Validation of payload - where to do best?

Hi hono developers,


While implementing further details of the Hono credentials API, I wondered about where to add the validation checks of the payload of requests.


AMQP message properties are checked very “early”, meaning: that mandatory params are fully contained is checked directly when the AMQP message is received. In that case the message is not further worked on, IMHO the best solution.

If the message is ok, it is passed over to another verticle which “tries” to work on that message and generates the appropriate reply.


The questionable part is now the (JSON) payload – should it be fully checked directly when receiving the message, or should it be sent to the event bus and is checked when the worker verticle needs to access the data?


I would slightly prefer the later (check late in the worker verticle) but it is not as clear as if it was checked together with the message properties directly when receiving. On the other hand it eliminates double parsing of the JSON object.

But then : intentionally bad requests (wrong payload) could create more load to Hono than fully checking the message at the very beginning.


Any clear opinions on that topic?






Back to the top