Deploy module twice with different configuration

234 views
Skip to first unread message

Dmitry Sklyut

unread,
Jul 24, 2012, 5:04:20 PM7/24/12
to ve...@googlegroups.com
Hi,

I might be missing something in documentation, but how would I go about deploying a mod, for example work-queue twice with different configuration?

Following throws exception: Module already installed
<code>
container.deployModule( "vertx.work-queue-v1.0",
                               new JsonObject().putString( "address", "x");
container.deployModule( "vertx.work-queue-v1.0",
                               new JsonObject().putString( "address", "y");
</code> 

Found this in VerticleManager
<code>
log.info("Installing module into directory '" + modRoot + "'");
        File fdest = new File(modRoot, modName);
        if (fdest.exists()) {
          log.error("" +
                        "Module is already installed");
          return false;
        }
</code>

Why would this be an error?  Can't it be treated as "Oh yea - it is already there - so lets use it"?

I saw a note in the in docs about using deployVerticle for already deploy mods.  But I am having issues trying to get a proper main name.
Given an example of work-queue module, can someone please show me how to deploy it twice from code with different configs?

Also - is there a way to check if module was installed already?

Regards,
Dmitry

Dmitry Sklyut

unread,
Jul 24, 2012, 5:27:02 PM7/24/12
to ve...@googlegroups.com
Just to follow up:

I was able to get it working with deploying second instance of the module in the installation callback handler of the first instance.

i.e. something like this: 
<code>
container.deployModule( "vertx.work-queue-v1.0",
                               new JsonObject().putString( "address", "x"), 1, new Handler<String>() {
                                    @Override
                                    public void handle( String event ) {
                                        if ( event != null ) {
                                            container.deployModule( "vertx.work-queue-v1.0",
                               new JsonObject().putString( "address", "y");
}});
</code>

Is that the way to do it?

Thanks

Tim Fox

unread,
Jul 25, 2012, 6:26:59 AM7/25/12
to ve...@googlegroups.com
Thanks.

In your first code example, the two deployments happen in parallel, and there's a race condition when you attempt this with the same module name.

What happens is:

T1: Module is already deployed? No
T2: Module is already deployed? No
T1: Download and install module
T2: Download, and try and install module: Oops it's already there.

Workaround is to do what you did: I.e. wait until one deployment is stopped before starting the next one.

I've fixed this in master already.

Dmitry Sklyut

unread,
Jul 25, 2012, 11:48:26 AM7/25/12
to ve...@googlegroups.com
Great!  Thanks.  Just tested and it looks to work without delaying secondary deployment.
 
Dmtiry

Venkata

unread,
May 23, 2014, 3:08:11 AM5/23/14
to ve...@googlegroups.com

Hi,

I tried to deploy redis module with different configurations (means different redis servers).
After starting the server, initiall few mins, both redis servers can be accessed.
But immediately after a couple of mins, i am not able to access one of the redis servers, seems connection getting dropped.

I couldn't see any errors in tmp directory for vertx log files.

Any suggestions on how to debug this issue to connect two redis servers always ???

Regards
Venkat

Venkata

unread,
May 25, 2014, 11:21:01 AM5/25/14
to ve...@googlegroups.com
can some one look into this issue...

deploying twice the redis module with different configuration but one connection abruptly terminates in no less than 5 mins....

thanks in advance...

Venkata

unread,
Aug 18, 2014, 7:29:35 AM8/18/14
to ve...@googlegroups.com
Hi ,

Regarding the same issue when two same redis modules deployed with different configurations :

Below are the observations :

1. The one redis server among two redis configurations which are hosted on the same machine as Vertx server is working fine.
The other one throwing an exception as below  :

Connection closed
Socket closed
Socket client error
java.io.IOException: Connection timed out
        at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:192)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
        at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:311)
        at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:871)
        at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:224)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:108)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:494)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:461)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:378)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:350)
        at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
        at java.lang.Thread.run(Thread.java:744)


2. If the redis servers are on the same machine as vertx server then two redis modules are working fine.

Does this related to connection issue of redis to other host machines ? how can it be resolved ?

Regards
Venkat

Venkat

unread,
Sep 3, 2014, 8:20:10 AM9/3/14
to ve...@googlegroups.com
Hi All.

Does any one has the similar scenarios explained below to deploy redis module with multiple configurations..

Regards
Venkat
Reply all
Reply to author
Forward
0 new messages