service locator & service gateway

504 views
Skip to first unread message

David Pennell

unread,
Sep 22, 2016, 6:18:15 PM9/22/16
to Lagom Framework Users
http://www.lagomframework.com/documentation/1.0.x/java/ServiceLocator.html#Service-Locator explains service locator.
Where can I find info on the service gateway (not sure what its function is)

-david

Jules Ivanic

unread,
Sep 26, 2016, 7:57:55 AM9/26/16
to Lagom Framework Users
Hi,

Same question here. Mirco talked about this "service gateway" here https://groups.google.com/d/msg/lagom-framework/4J9T_T4EcGE/lZSNw7RhAgAJ without more explanations.

James Roper

unread,
Sep 26, 2016, 8:43:27 PM9/26/16
to Jules Ivanic, Lagom Framework Users
A service gateway is a proxy server into your services from the outside world.  Without it, your services can talk to each other, but nothing can talk to your services.  For example, if you're developing a webapp, you may want the browser to be able to make calls to your services - but you don't want the browser to have to know the IP/port number of each service, so instead it talks to the service gateway.

--
You received this message because you are subscribed to the Google Groups "Lagom Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lagom-framework+unsubscribe@googlegroups.com.
To post to this group, send email to lagom-framework@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lagom-framework/7615cff7-3efa-46ca-8e84-92cbad43589d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
James Roper
Software Engineer

Lightbend – Build reactive apps!
Twitter: @jroper

David Pennell

unread,
Sep 27, 2016, 7:07:39 AM9/27/16
to Lagom Framework Users, jules....@gmail.com
Thanks for the explanation. 

So, for most use-cases, you'll need both a service locator and a service gateway.

I did some more digging over the weekend.

The Lagom community has multiple choices for Service Locator:
- conductr - nice solution, but many have organizational/business constraints that preclude it's use

For service gateway:

- Conductr wraps haproxy
- "wrapping" means that you need to update haproxy configuration whenever the service registry changes
-  haproxy seems to be a solid choice, unless you need support for UDP (we do) - nginx seems to be next in line.  I'm sure that we are in the minority.

For service registry:  Are there any plans for Lagom to provide an abstraction over this?  Both the zookeeper and consul service locators require manual register/de-register with registry specific code.

-david



On Monday, September 26, 2016 at 8:43:27 PM UTC-4, James Roper wrote:
A service gateway is a proxy server into your services from the outside world.  Without it, your services can talk to each other, but nothing can talk to your services.  For example, if you're developing a webapp, you may want the browser to be able to make calls to your services - but you don't want the browser to have to know the IP/port number of each service, so instead it talks to the service gateway.
On 26 September 2016 at 21:57, Jules Ivanic <jules....@gmail.com> wrote:
Hi,

Same question here. Mirco talked about this "service gateway" here https://groups.google.com/d/msg/lagom-framework/4J9T_T4EcGE/lZSNw7RhAgAJ without more explanations.

Le vendredi 23 septembre 2016 00:18:15 UTC+2, David Pennell a écrit :
http://www.lagomframework.com/documentation/1.0.x/java/ServiceLocator.html#Service-Locator explains service locator.
Where can I find info on the service gateway (not sure what its function is)

-david

--
You received this message because you are subscribed to the Google Groups "Lagom Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lagom-framewo...@googlegroups.com.
To post to this group, send email to lagom-f...@googlegroups.com.

James Roper

unread,
Sep 27, 2016, 8:14:45 PM9/27/16
to David Pennell, Lagom Framework Users, Jules Ivanic
On 27 September 2016 at 21:07, David Pennell <dpen...@good-cloud.com> wrote:
Thanks for the explanation. 

So, for most use-cases, you'll need both a service locator and a service gateway.

I did some more digging over the weekend.

The Lagom community has multiple choices for Service Locator:
- conductr - nice solution, but many have organizational/business constraints that preclude it's use

For service gateway:

- Conductr wraps haproxy
- "wrapping" means that you need to update haproxy configuration whenever the service registry changes
-  haproxy seems to be a solid choice, unless you need support for UDP (we do) - nginx seems to be next in line.  I'm sure that we are in the minority.

For service registry:  Are there any plans for Lagom to provide an abstraction over this?  Both the zookeeper and consul service locators require manual register/de-register with registry specific code.

I hadn't considered providing an abstraction over it - I'm also not 100% sure that an abstraction is the right way to go.  So at some point in future there will be some zookeeper support and some consul support (probably community provided) that will do the registration.  The common bits of code between them will be very little, because all they need to do is create an eager singleton that does the binding, look at the ServiceInfo to get the service name, lookup the IP/port from the environment, and register a stop hook, the rest is the actual making the call.  I'm just not sure that putting an abstraction there will improve anything over each plugin doing all that manually, abstractions add complexity and make things harder to debug due to the indirection introduced, so they have to offer significant value if you introduce one.

-david



On Monday, September 26, 2016 at 8:43:27 PM UTC-4, James Roper wrote:
A service gateway is a proxy server into your services from the outside world.  Without it, your services can talk to each other, but nothing can talk to your services.  For example, if you're developing a webapp, you may want the browser to be able to make calls to your services - but you don't want the browser to have to know the IP/port number of each service, so instead it talks to the service gateway.

On 26 September 2016 at 21:57, Jules Ivanic <jules....@gmail.com> wrote:
Hi,

Same question here. Mirco talked about this "service gateway" here https://groups.google.com/d/msg/lagom-framework/4J9T_T4EcGE/lZSNw7RhAgAJ without more explanations.

Le vendredi 23 septembre 2016 00:18:15 UTC+2, David Pennell a écrit :
http://www.lagomframework.com/documentation/1.0.x/java/ServiceLocator.html#Service-Locator explains service locator.
Where can I find info on the service gateway (not sure what its function is)

-david

--
You received this message because you are subscribed to the Google Groups "Lagom Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lagom-framewo...@googlegroups.com.
To post to this group, send email to lagom-f...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lagom-framework/7615cff7-3efa-46ca-8e84-92cbad43589d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
James Roper
Software Engineer

Lightbend – Build reactive apps!
Twitter: @jroper

--
You received this message because you are subscribed to the Google Groups "Lagom Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lagom-framework+unsubscribe@googlegroups.com.
To post to this group, send email to lagom-framework@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lagom-framework/ae0fd2f6-6806-4b1b-816c-fb1782bac63c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

David Pennell

unread,
Sep 28, 2016, 2:20:55 PM9/28/16
to Lagom Framework Users, dpen...@good-cloud.com, jules....@gmail.com


On Tuesday, September 27, 2016 at 8:14:45 PM UTC-4, James Roper wrote:
On 27 September 2016 at 21:07, David Pennell <dpen...@good-cloud.com> wrote:
Thanks for the explanation. 

So, for most use-cases, you'll need both a service locator and a service gateway.

I did some more digging over the weekend.

The Lagom community has multiple choices for Service Locator:
- conductr - nice solution, but many have organizational/business constraints that preclude it's use

For service gateway:

- Conductr wraps haproxy
- "wrapping" means that you need to update haproxy configuration whenever the service registry changes
-  haproxy seems to be a solid choice, unless you need support for UDP (we do) - nginx seems to be next in line.  I'm sure that we are in the minority.

For service registry:  Are there any plans for Lagom to provide an abstraction over this?  Both the zookeeper and consul service locators require manual register/de-register with registry specific code.

I hadn't considered providing an abstraction over it - I'm also not 100% sure that an abstraction is the right way to go.  So at some point in future there will be some zookeeper support and some consul support (probably community provided) that will do the registration.  The common bits of code between them will be very little, because all they need to do is create an eager singleton that does the binding, look at the ServiceInfo to get the service name, lookup the IP/port from the environment, and register a stop hook, the rest is the actual making the call.  I'm just not sure that putting an abstraction there will improve anything over each plugin doing all that manually, abstractions add complexity and make things harder to debug due to the indirection introduced, so they have to offer significant value if you introduce one.

Jonas' zookeeper project (https://github.com/jboner/lagom-service-locator-zookeeper) already has a simple helper for registering.  His consul project uses the consul API directly.   In looking at his example, I was surprised to not see register and unregister hooks for the service.

Jules Ivanic

unread,
Oct 5, 2016, 5:08:35 AM10/5/16
to Lagom Framework Users, dpen...@good-cloud.com, jules....@gmail.com
How can we change the service gateway ? For example, if I want to use Nginx as service gateway with Stormpath (authentification SaaS) script (https://github.com/stormpath/stormpath-nginx) inside to manage security, how can I say to Lagom where is my Nginx ? How do I register routes in Nginx with Lagom (assume that I know the Nginx API to register/deregister data) ?

James Roper

unread,
Oct 9, 2016, 1:51:09 PM10/9/16
to Jules Ivanic, Lagom Framework Users, David Pennell
On 5 October 2016 at 04:08, Jules Ivanic <jules....@gmail.com> wrote:
How can we change the service gateway ? For example, if I want to use Nginx as service gateway with Stormpath (authentification SaaS) script (https://github.com/stormpath/stormpath-nginx) inside to manage security, how can I say to Lagom where is my Nginx ? How do I register routes in Nginx with Lagom (assume that I know the Nginx API to register/deregister data) ?

Do you mean in production, or development?  In development there's no way to disable the service gateway, that said, you don't need to use the service gateway, and you could easily run your own.  In production, it's up to you to run your own unless you're using ConductR.  As far as automatic registration is concerned, that should be straight forward, this is how we register services in dev mode with the dev mode service gateway, you could do something similar that registered things with nginx on service startup:


 
To unsubscribe from this group and stop receiving emails from it, send an email to lagom-framework+unsubscribe@googlegroups.com.
To post to this group, send email to lagom-framework@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lagom-framework/d32998bf-9bda-4190-88bc-16b7346714c6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages