TL;DR
No, do not place business objects inside a gateway. Keep your coupling as weak as possible.
Explanation
A gateway should not know the core business.
Therefore, no, you should not insert business objects into the gateway layer. This helps preserve the low (or near zero) coupling.
Thus, the gateway plays only the simpleton role of a 'passthrough''.
Of course, there are gateways and gateways. Nowadays the Gateways API does much more than that. They are able to do security and, in many, even orchestration and enrichment of messages - whether this is right or wrong does not come into the topic, but my opinion is that the gateway should never be used to make orchestrations and enrichments, it should only make a layer of security and routing to the target back-end.
If you are using Spring, it would be interesting to take a look at the Spring Cloud stack. There is the Zuul API Gateway. It would play this role that you implemented absolutely well and has an immense ease of configuration.
It’s a Java project like any other, with libraries imported through Maven or Gradle, but you just set it up using a YAML file and you’re done! Your gateway is working
I’m not sure why you want to put services in a gateway, which is basically responsible for directing requests only. All your gateway needs is the microservice address to where it needs to direct the request.
– StatelessDev
Okay! So you don’t have to put the layers out, just redirect it and that’s it, right? By the way of the question: the customer does not want to access multiple endponts to receive similar information, requested only one place to collect the information, as the origins were different, the companies involved each made their own service and then unified everything as gateway. Answers the question for me to point out as a solution ;-) :-)
– SantanaFire