how can I get the options in non-main verticle?

24 views
Skip to first unread message

xunitc xc

unread,
Nov 27, 2015, 5:51:27 AM11/27/15
to vert.x
hi,

in my MainVerticle.groovy, I use this to deploy other Verticle:

vertx.deployVerticle("MyVerticle.groovy", ['worker':true]);


in MyVerticle.groovy, I want to get the options:

public class MyVerticle extends GroovyVerticle {
   
public void start() {
       
def options = vertx.getOrCreateContext().config();
        println
(options);
   
}
}


it can work, but the options is null.
how can I get the options=['worker':true] in MyVerticle.groovy please?
btw: I do not want to compile MyVerticle.groovy.

Clement Escoffier

unread,
Nov 27, 2015, 6:06:38 AM11/27/15
to ve...@googlegroups.com
Hello,

You need to pass the configuration to the child version. As I can see you are configuring the deployment options with ‘worker’ set to true. You can configure the configuration at the same place:
[‘worker’:true, ‘config’: [ ‘key’ : ‘value’]]

Clement

--
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 http://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/814d1d41-f59c-4b21-a7f9-a34a13805b65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

xunitc xc

unread,
Nov 27, 2015, 6:15:59 AM11/27/15
to vert.x
Hi clement escoffier,

It works good now. Thank you for your help.

在 2015年11月27日星期五 UTC+8下午7:06:38,clement escoffier写道:
Reply all
Reply to author
Forward
0 new messages