vert-x / mod-lang-clojure

Vert.x 2.x is deprecated - use instead
http://vertx.io
Other
74 stars 15 forks source link

Flesh out embedding support to wrap PlatformManager #34

Closed tobias closed 10 years ago

stream-iori commented 11 years ago

Well, how to flesh out, may you specific some point? let me see may i do a favor

tobias commented 11 years ago

Sure - there are two ways to embed: by creating a Vertx instance, or by creating a PlatformManager. The embed ns currently only handles Vertx creation, so the remaining piece is the PlatformManager. We would need a fn to create one, and fns that wrap the deploy* methods of the PM. They would be very similar to the deploy fns in core, but take different parameters.

Stream1984 writes:

Well, how to flesh out, may you specific some point? let me see may i do a favor


Reply to this email directly or view it on GitHub: https://github.com/vert-x/mod-lang-clojure/issues/34#issuecomment-22558559

Toby Crawley http://immutant.org | http://torquebox.org

stream-iori commented 11 years ago

ha, this look like could replace the way of startup Vertx, with it we would not use script of vertx to startup Verticle, even in cluster, did i understand correctly?

tobias commented 11 years ago

You could use it that way, yes. But since there is no VerticleFactory, and you are already inside the clojure runtime, all clojure verticles would share that same runtime.

Stream1984 writes:

ha, this look like could replace the way of startup Vertx, with it we would not use script of vertx to startup Verticle, even in cluster, did i understand correctly?


Reply to this email directly or view it on GitHub: https://github.com/vert-x/mod-lang-clojure/issues/34#issuecomment-22612190

Toby Crawley http://immutant.org | http://torquebox.org

stream-iori commented 11 years ago

Ok. i think i got it. Thanks.

On 2013年8月14日, at 11:06, Toby Crawley notifications@github.com wrote:

You could use it that way, yes. But since there is no VerticleFactory, and you are already inside the clojure runtime, all clojure verticles would share that same runtime.

Stream1984 writes:

ha, this look like could replace the way of startup Vertx, with it we would not use script of vertx to startup Verticle, even in cluster, did i understand correctly?


Reply to this email directly or view it on GitHub: https://github.com/vert-x/mod-lang-clojure/issues/34#issuecomment-22612190

Toby Crawley http://immutant.org | http://torquebox.org — Reply to this email directly or view it on GitHub.

stream-iori commented 11 years ago

I try to wrap Platform Manager as Container, so fn deploy* would work fine, even in embed. but i get a Exception "Cannot find parent classpath. Perhaps you are deploying the verticle from a non Vert.x thread?" which in line of 384 in DefalutPlatformManager.

Well, i think that is missing some classpath which could be make while deployment with command vertx.

i guess it would be work fine in test if i pass VerticleClasspath to PlatformManger. i would try it continue in couple of days.

tobias commented 11 years ago

If used outside of a Vert.x thread, the PlatformManager deploy methods require some sort of classpath passed to it, even if it is an empty array of URLs (new URL[0]). So you'll need to pass something to test your code.

stream-iori commented 11 years ago

Yes. i have tried to make URL[] to methods of deploys there are still a lot of things to be done, since child module is lang of clojure, so i have to load clojureVerticle, or the PlatformManger will see my child as a JavaVerticle, then throw Exception ClassNotFoundException.

i have look into the TestTools, well i think i don't have do same working.

but i would try to make PlatformManger done in embed.clj

what do you think ?

tobias commented 11 years ago

I looked at our pull request (#47), and I think we should take a different approach. Instead of providing a container that can be used by the deploy functions in core, I'd rather provide a set of deploy functions in embed.clj, since the platform manager provides different deploy functionality. Having deploy functions in embed.clj also helps draw the line between embedded vs. in-container deploys, which should reduce confusion, since they behave differently.

Does that make sense?

Stream1984 writes:

Yes. i have tried to make URL[] to methods of deploys there are still a lot of things to be done, since child module is lang of clojure, so i have to load clojureVerticle, or the PlatformManger will see my child as a JavaVerticle, then throw Exception ClassNotFoundException.

i have look into the TestTools, well i think i don't have do same working.

but i would try to make PlatformManger done in embed.clj

what do you think ?


Reply to this email directly or view it on GitHub: https://github.com/vert-x/mod-lang-clojure/issues/34#issuecomment-23535671

Toby Crawley http://immutant.org | http://torquebox.org

stream-iori commented 11 years ago

yes, i agree that provided a set of speical function for embed. and i am thinking should we providing functions like in-container deploys in embed? Embeding just make Vertx's function as a part of project not Container, maybe user's project running is not depending on Container of Vertx, maybe is Spring Container or JBoss..

and project vertx also split its architecture to vertx-core and vertx-platform.

so what do you thinking? may we have done too far?

Toby Crawley writes:

I looked at our pull request (#47), and I think we should take a different approach. Instead of providing a container that can be used by the deploy functions in core, I'd rather provide a set of deploy functions in embed.clj, since the platform manager provides different deploy functionality. Having deploy functions in embed.clj also helps draw the line between embedded vs. in-container deploys, which should reduce confusion, since they behave differently.

Does that make sense?

Stream1984 writes:

Yes. i have tried to make URL[] to methods of deploys there are still a lot of things to be done, since child module is lang of clojure, so i have to load clojureVerticle, or the PlatformManger will see my child as a JavaVerticle, then throw Exception ClassNotFoundException.

i have look into the TestTools, well i think i don't have do same working.

but i would try to make PlatformManger done in embed.clj

what do you think ?


Reply to this email directly or view it on GitHub: https://github.com/vert-x/mod-lang-clojure/issues/34#issuecomment-23535671

Stream Liu Blog: www.streamis.me

tobias commented 11 years ago

@stream1984 - sorry I haven't gotten back to you on this - I've had to work on other things lately. I'll try to think about embedding in the next couple of weeks and start this discussion again.

tobias commented 10 years ago

I've bumped this to 0.4.0 - I want to get 0.3.0 out today, and haven't had a chance to look at embedding.

yerinle commented 10 years ago

I believe embedding now works. Should this ticket be closed?

tobias commented 10 years ago

Embedding works currently - this issue is really about exposing the PlatformManager functionality in clojure so you don't have to do interop to use it.