vert-x / mod-lang-php Goto Github PK
View Code? Open in Web Editor NEWVert.x 2.x is deprecated - use instead
Home Page: http://vertx.io
License: MIT License
Vert.x 2.x is deprecated - use instead
Home Page: http://vertx.io
License: MIT License
I opened this Issue once before in the old repo.
As the Test shows in my branch: https://github.com/CansaSCityShuffle/mod-lang-php/tree/test-print-in-proc
its currently not possible to print sth. in a Evenbus Handler callback, but in a normal callback, as the Test shows below.
The last guess was a quercus bug, but I think it has sth. to do with an uninitialized WriteStream. Therefore I tried to identify the Place where this should happen, but I'm struggeling with one thing:
In the PHP code I'm calling:
$this->eventBus = Vertx::eventBus()
:
$this->eventBus->registerHandler(String address, Closure callback)
When I take a look at Java classes, it seems to me that this method will be called:
https://github.com/vert-x/mod-lang-php/blob/master/src/main/java/io/vertx/lang/php/eventbus/EventBus.java#L90
But what happens with the env
variable? I think, that this env
variable is the key to solve this bug, so I hope you can help me out.
... and also expose uri() method in ServerWebSocket
Thanks!
Also, can we extend this to include event bus send reply failures?
All the README.md links point to Jordan's original repo, which now 404's.
Hope the wonderful documentation is not lost...
The Java eventbus now supports sends with timeout, also the Message class supports replies with timeouts.
We should expose this new functionality in the PHP API too
Thanks!
I am trying to add a common features that is available in traditional PHP stack, global exception handling. I am modifying reportException() in PhpVerticleFactory.java
After compiling the class, all works fine but it throws an exception when I tried to run a module with:
vertx runmod xxxx -instances 2
Failed in deploying module
java.lang.ArrayIndexOutOfBoundsException: 256
at com.caucho.quercus.QuercusContext.setFunction(QuercusContext.java:1469)
at com.caucho.quercus.QuercusContext.initModuleInfo(QuercusContext.java:1963)
at com.caucho.quercus.QuercusContext.initModules(QuercusContext.java:1906)
at com.caucho.quercus.QuercusContext.init(QuercusContext.java:1835)
at io.vertx.lang.php.PhpVerticleFactory.initQuercusContext(PhpVerticleFactory.java:109)
at io.vertx.lang.php.PhpVerticleFactory.createVerticle(PhpVerticleFactory.java:178)
at org.vertx.java.platform.impl.DefaultPlatformManager$19.run(DefaultPlatformManager.java:1527)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:176)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:722)
java.lang.NullPointerException
at io.vertx.lang.php.PhpVerticleFactory.initQuercusContext(PhpVerticleFactory.java:110)
at io.vertx.lang.php.PhpVerticleFactory.createVerticle(PhpVerticleFactory.java:178)
at org.vertx.java.platform.impl.DefaultPlatformManager$19.run(DefaultPlatformManager.java:1527)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:176)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:722)
I noticed that in my compiled folder PhpVerticleFactory.java is compiled into 3 classes.
PhpVerticleFactory.class
PhpVerticleFactory$1.class
PhpVerticleFactory$PhpVerticle.class
while the php mod install/downloaded from vertx registry only has
PhpVerticleFactory.class
PhpVerticleFactory$PhpVerticle.class
... on HttpClient and HttpServer by exposing the getter/setter for MaxWebSocketFrameSize
Thanks!
When running script with more than 1 instance, latest mod-lang-php with vertx 2.1M will throw ArrayIndexOutOfBoundsException:
vertx run index.php -instances 2
java.lang.ArrayIndexOutOfBoundsException: 256
at com.caucho.quercus.QuercusContext.setFunction(QuercusContext.java:1469)
at com.caucho.quercus.QuercusContext.initModuleInfo(QuercusContext.java:1963)
at com.caucho.quercus.QuercusContext.initModules(QuercusContext.java:1906)
at com.caucho.quercus.QuercusContext.init(QuercusContext.java:1835)
at io.vertx.lang.php.PhpVerticleFactory.initQuercusContext(PhpVerticleFactory.java:109)
at io.vertx.lang.php.PhpVerticleFactory.createVerticle(PhpVerticleFactory.java:178)
at org.vertx.java.platform.impl.DefaultPlatformManager$19.run(DefaultPlatformManager.java:1541)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:176)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:722)
java.lang.NullPointerException
at io.vertx.lang.php.PhpVerticleFactory.initQuercusContext(PhpVerticleFactory.java:110)
at io.vertx.lang.php.PhpVerticleFactory.createVerticle(PhpVerticleFactory.java:178)
at org.vertx.java.platform.impl.DefaultPlatformManager$19.run(DefaultPlatformManager.java:1541)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:176)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:722)
java.lang.NullPointerException
at io.vertx.lang.php.PhpVerticleFactory.initQuercusContext(PhpVerticleFactory.java:110)
at io.vertx.lang.php.PhpVerticleFactory.createVerticle(PhpVerticleFactory.java:178)
at org.vertx.java.platform.impl.DefaultPlatformManager$19.run(DefaultPlatformManager.java:1541)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:176)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:722)
Currently, the PHP implementation does nothing to support including modules. Obviously this is an important aspect of the new Vert.x module system. Allowing PHP libraries to be included via the Vert.x mod.json
file may require some creativity. The PhpVerticleFactory
will most certainly need to be refactored to use a single engine for all PHP verticles within a Vert.x instance. I've played with this a little bit. What is required is to be able to execute multiple scripts within the same engine, but I haven't come up with an elegant solution yet. Pull requests are welcome :-)
See also:
eclipse-vertx/vert.x@633ccaa
Thanks!
I found that the SockJS implementation in mod php isn't complete:
public SockJSServer setHook(Env env, ObjectValue hook) {
return this;
}
It should reflect what the Java api did at https://github.com/eclipse/vert.x/blob/master/vertx-core/src/main/java/org/vertx/java/core/sockjs/impl/DefaultSockJSServer.java
public SockJSServer setHook(EventBusBridgeHook hook) {
this.hook = hook;
return this;
}
Not quite sure how do you map this back to a language mod like mod php.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.