Open pmlopes opened 1 year ago
Extra helpers could be added. Like in the example above, we could have a helper just for passing the auth-token
as:
service = new MicroServiceVertxEBProxy(vertx, MicroService.ADDRESS);
service
.execute()
.authorizeAndCall(ctx.user().get("id_token"))
The current proxy generator is very simple and does not take into consideration the headers in the event bus message. In a scenario where a user would want to send a
Authentication
token with the message to attest the id of the caller, this is currently not supported and requires the user to manually perform the marshalling, e.g.:This example is simple as the service method
execute
takes no arguments. This approach avoids the current generator that is unable to set headers and would like like:In order to address this we should have a better generated proxy, for example it should be usable as:
Here in the optional argument of call, one can capture the request, (say we're on vertx-web) and add the required headers, e.g.:
In order to achive this we would need some abstract proxy class:
Then the generator would generate the following code:
With this approach we can now annotate the message with the headers we wish.