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
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:
service = newMicroServiceVertxEBProxy(vertx, MicroService.ADDRESS);
service.execute()
In order to address this we should have a better generated proxy, for example it should be usable as:
service = newMicroServiceVertxEBProxy(vertx, MicroService.ADDRESS);
service
.execute()
.call(deliveryOptions -> { ... })
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.:
Then the generator would generate the following code:
// for each method in the @ProxyGen interface//@OverridepublicCaller<String> method_name() { // <-- note Caller instead of `Future`if (closed) returnnewCaller<>(io.vertx.core.Future.failedFuture("Proxy is closed"));
// encoding to JSON as usual...// ...returnnewCaller<>("execute", _json);
}
With this approach we can now annotate the message with the headers we wish.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: