vert-x / mod-lang-clojure Goto Github PK
View Code? Open in Web Editor NEWVert.x 2.x is deprecated - use instead
Home Page: http://vertx.io
License: Other
Vert.x 2.x is deprecated - use instead
Home Page: http://vertx.io
License: Other
And change the build to test with 2.1M1.
We would need a mechanism to reply. Perhaps we could bind the message object to a dynamic var, and have the reply fn look at that.
The js implementation passes a reply fn as an optional second arg to the handler fn. I wish detecting arity was easier in clojure, and we could do something similar.
Clojure tooling will use this file when connecting to the repl if it is available. The file should be deleted on JVM exit.
This is needed for handlers created outside the event loop.
See also:
eclipse-vertx/vert.x@633ccaa
Currently, specifying only some of the hooks results in NPEs when the hooks are applied, since the reified EventBusBridgeHook doesn't check for the existence of a hook fn before trying to call it.
try to mvm install, then get exception
java.lang.IllegalArgumentException: No matching method found: getMap for class clojure.lang.Var$Unbound
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:53)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
at vertx.shareddata$get_map.invoke(shareddata.clj:37)
at vertx.shareddata_test$test_map.invoke(shareddata_test.clj:21)
at clojure.lang.Var.invoke(Var.java:411)
at vertx.testtools$start_tests.invoke(testtools.clj:26)
at vertx.shareddata_test$eval2230.invoke(shareddata_test.clj:46)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.RT.loadResourceScript(RT.java:370)
at clojure.lang.RT.loadResourceScript(RT.java:357)
at clojure.lang.RT.loadResourceScript(RT.java:349)
at io.vertx.lang.clojure.ClojureVerticleFactory$ClojureVerticle.start(ClojureVerticleFactory.java:85)
at org.vertx.java.platform.Verticle.start(Verticle.java:82)
at org.vertx.java.platform.impl.DefaultPlatformManager$18.run(DefaultPlatformManager.java:1270)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:171)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:353)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:365)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:724)
It currently uses 0
.
If it's not a collection, we use the arg as a key to look up the collection.
Since we now have embedding, we can move a lot of the tests to api/, and probably have them be standard clojure.test tests. This should speed up the build immensely.
The 'repl' is redundant.
Deploying worker verticle programmatically throws java.lang.InvalidArgumentException. Deploying the same verticle such that its not a worker works.
Here is the code https://github.com/joshkamau/cljmod/blob/master/src/main/resources/testicle.clj
Thanks
Once it is released.
Some of the bridge hooks can cancel the requested operation, but will throw an exception if the hook fn returns a nil. We should coerce the return value to a boolean.
Which results in a decode exception, because the encode
for Seqable tries to encode to a JsonArray
. I believe this is caused by clojure maps being both Maps and Seqables, and the clojure dispatch logic may need a more specific extension.
src/test/resources/isolation|isolation_test.clj|test-samely-named-verticles-are-not-isolated(io.vertx.lang.clojure.integration.APIIntegrationTests) Time elapsed: 5.011 sec <<< FAILURE!
java.lang.AssertionError: expected:<2> but was:<1>
I clone project from here. mvn integration-test, get below exception in all the test
org.vertx.java.core.VertxException: java.io.FileNotFoundException: Could not locate vertx/testtools__init.class or vertx/testtools.clj on classpath:
does it work well in your computer?
see the sample project here https://github.com/joshkamau/cljmod
Start the server, connect with a browser, open the eventbus, subscribe, publish.
All the above works, but the message is never displayed in the 'received' pane.
Is the a plan to support Ring Request/Response maps?
The Java eventbus now supports sends with timeout, also the Message class supports replies with timeouts.
We should expose this new functionality in the Clojure API too
This is required to list the module in the registry. See the js module for an example.
INFO: Started clojure verticle: filesystem_async_test.clj
七月 17, 2013 10:56:50 上午 org.vertx.java.core.logging.impl.JULLogDelegate error
SEVERE: Unexpected exception in Clojure verticle
java.lang.NullPointerException
at clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:296)
at vertx.filesystem$file_props__GT_map.invoke(filesystem.clj:96)
at vertx.core$as_async_result_handler$fn__251.invoke(core.clj:96)
at vertx.core$as_handler$reify__237.handle(core.clj:64)
at org.vertx.java.core.impl.DefaultFutureResult.checkCallHandler(DefaultFutureResult.java:123)
at org.vertx.java.core.impl.DefaultFutureResult.setHandler(DefaultFutureResult.java:97)
at org.vertx.java.core.impl.BlockingAction$1$1.run(BlockingAction.java:58)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:171)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:353)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:365)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:724)
java.lang.AssertionError:
at org.junit.Assert.fail(Assert.java:91)
at org.junit.Assert.assertTrue(Assert.java:43)
at org.junit.Assert.assertNull(Assert.java:549)
at org.junit.Assert.assertNull(Assert.java:560)
at org.vertx.testtools.VertxAssert.assertNull(VertxAssert.java:110)
at vertx.testtools$assert_nil.invoke(testtools.clj:58)
at vertx.filesystem_async_test$test_hard_link$fn__3484.invoke(filesystem_async_test.clj:165)
at vertx.core$as_async_result_handler$fn__251.invoke(core.clj:98)
at vertx.core$as_handler$reify__237.handle(core.clj:64)
at org.vertx.java.core.impl.DefaultFutureResult.checkCallHandler(DefaultFutureResult.java:123)
at org.vertx.java.core.impl.DefaultFutureResult.setHandler(DefaultFutureResult.java:97)
at org.vertx.java.core.impl.BlockingAction$1$1.run(BlockingAction.java:58)
at org.vertx.java.core.impl.DefaultContext$3.run(DefaultContext.java:171)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:353)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:365)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:724)
七月 17, 2013 10:56:50 上午 org.vertx.java.core.logging.impl.JULLogDelegate info
https://github.com/p14n/vertx-clojure-demo
Hi, I've created the project above to demonstrate a classloader oddity I'm seeing. I created this because I was trying to trying to use Keywords in java and noticed that the static table in the Keyword was empty on the first access from java - Keyword was being instantiated twice.
I think this cast error is probably because Keyword has been loaded in two classloaders. You can try it out by running
prepare.sh
and then
run-clojure-script.sh to see it working
and
run-clojure-verticle.sh to see it not
Lein required.
Cheers!
Dean
Currently, all verticles use the same Clojure runtime. We should consider making that optional, with an option to have each verticle in an isolated runtime. We should be able to do it with https://github.com/tobias/clojure-runtime-shim.
Hey -
Thanks for the great work on this module. Very excited about it and willing to help out if you need a hand.
I've hit this issue twice now (unbound fn: #'clojure.core/refer), once when running an embedded platform manager, and once when using liverepl to connect to a vertx app. I suspect that this is always going to be the complexity to manage in vert.x - understanding classloader issues we hit.
Anyway, I solved it by removing clojure-1.6.0-threadlocals from the runtime directory, and loading 1.5.1 instead in my gradle dependencies. This issue is part solution for others, part request for information - shouldn't this module be making the clojure environment available to the module?
Cheers,
Dean
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.