Using vert.x as an API gateway

1,912 views
Skip to first unread message

Hai Nguyen

unread,
Jan 29, 2016, 1:51:39 PM1/29/16
to vert.x
Hi, how can I achieved this with Vertx, since some of our service are with nodejs and python. I wanna create an api gateway with vertx that do st like this: 

/api/search => mount to IP and port of other service (other language)
/api/post => vertx router
 
Thanks 

Cosmic Interloper

unread,
Jan 29, 2016, 2:07:40 PM1/29/16
to ve...@googlegroups.com
there are some really good event bus clients out there
https://github.com/vert-x3/vertx-awesome#vertx-event-bus-clients

I have experience using the npm/js based one in node,

it will give you an event emitter, and send/publish methods, for the eventbus, so from there you can talk to any part of the vertx ecosystem, or set handlers to react to vertx messages in your node program

the c++ module could, in theory, be compiled into a native python extension (yuck) or you could use raw websockets in python

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/d0745d7c-6dd5-40ec-9ddd-7ce31dbb971d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cosmic Interloper

unread,
Jan 29, 2016, 2:10:09 PM1/29/16
to ve...@googlegroups.com
I should also mention that some of your node code may run in vertx-js, and there IS a stillborn, almost complete vertx3-lang-python module, for the daring and skilled.

Julien Viet

unread,
Jan 29, 2016, 2:21:06 PM1/29/16
to ve...@googlegroups.com
you could use an HttpServer whose handler delegates to a reverse proxy handler (i.e uses a Vert.x HttpClient to connect to the other service) on /api/search and delegates to a Vert.x Web router on /api/post .


Hai Nguyen

unread,
Jan 30, 2016, 3:27:17 AM1/30/16
to vert.x
@Cosmic Interloper :Thank you ;) 
@JulienThanks, can you write a simple sample please ?

Alexander Lehmann

unread,
Jan 30, 2016, 7:18:59 AM1/30/16
to vert.x
you can probably use the proxy example from the vertx-examples repo

https://github.com/vert-x3/vertx-examples/blob/master/core-examples/src/main/java/io/vertx/example/core/http/proxy/Proxy.java

There may be a better solution available with vertx-web, but I have not used that at all

Hai Nguyen

unread,
Jan 31, 2016, 11:35:12 AM1/31/16
to vert.x
Thanks, i managed to find a similar concept with nginx, you can see 

Reply all
Reply to author
Forward
0 new messages