Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ test-results
test-tmp
*.class
mods
vertx_classpath.txt
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ dependencies {
provided "org.codehaus.groovy:groovy-all:$groovyVersion"
provided "io.vertx:lang-groovy:$groovyLangModVersion@jar"

// If you're creating Scala compiled verticles you may need the following dependencies
provided "org.scala-lang:scala-library:$scalaVersion"
provided "org.scala-lang:scala-compiler:$scalaVersion"
provided "io.vertx:$scalaLangModVersion"
}

test {
Expand Down
18 changes: 18 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,27 @@ groovyLangModVersion=2.0.0-final
# The version of Groovy to use (if you are using Groovy)
groovyVersion=2.1.5


# The version of the Scala module
#rememeber to add to the default language:
# scala=io.vertx~lang-scala_2.10~1.0.1-RC3:org.vertx.scala.platform.impl.ScalaVerticleFactory
# scala=io.vertx~lang-scala_2.11~1.0.1-RC3:org.vertx.scala.platform.impl.ScalaVerticleFactory
# OR
# "lang-impl":"io.vertx~lang-scala_2.10~1.0.1-RC3:org.vertx.scala.platform.impl.ScalaVerticleFactory",
# "lang-impl":"io.vertx~lang-scala_2.11~1.0.1-RC3:org.vertx.scala.platform.impl.ScalaVerticleFactory",
# to your mod.json according to the scala target
scalaLangModVersion=lang-scala_2.11:1.0.1-RC3
#old version
#scalaLangModVersion=lang-scala:1.0.0


# The version of Scala to use
scalaVersion=2.11.2

# Gradle version
gradleVersion=1.10


# The version of Vert.x
vertxVersion=2.1.2

Expand Down
1 change: 1 addition & 0 deletions gradle/vertx.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.vertx.java.platform.impl.cli.Starter

apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'scala'
apply plugin: 'idea'
apply plugin: 'eclipse'

Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/ScalaVerticle.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import org.vertx.scala.core.eventbus.Message

val log = container.logger
vertx.eventBus.registerHandler("ping-address", {message:Message[String] =>
message.reply("pong!")
log info "Sent back pong scala!"
})
15 changes: 15 additions & 0 deletions src/main/resources/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@
// Compiled Groovy verticle - note that they must be prefixed with 'groovy:' to distinguish them from compiled Java verticles
//"main":"groovy:com.mycompany.myproject.GroovyPingVerticle",

// Compiled Scala verticle - note that they must be prefixed with 'scala:' to distinguish them from compiled Java verticles
//"main":"scala:com.mycompany.myproject.ScalaPingVerticle",

// Groovy *script* verticle
//"main": "GroovyVerticle.groovy",

// Scala *script* verticle (No sirve todavia con las nuevas versiones del lang-scala)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Umm... sorry, what does that mean? :)

//"main": "ScalaVerticle.scala",

// Ruby verticle
//"main":"ping_verticle.rb",

Expand All @@ -25,6 +31,15 @@
//"main": "ping_verticle.py",


//If youre using the new version of scala with scala 2.11
//""lang-impl":"io.vertx~lang-scala_2.10~1.0.1-RC3:org.vertx.scala.platform.impl.ScalaVerticleFactory",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a single ", I guess?

//"lang-impl":"io.vertx~lang-scala_2.11~1.0.1-RC3:org.vertx.scala.platform.impl.ScalaVerticleFactory",

//Remember for FAT Jars to add thedependencies so the engine doesn't have to re-download them everytime
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the dependencies

//"deploys": "io.vertx~lang-scala_2.11~1.0.1-RC3",
//"deploys": "io.vertx~lang-groovy~2.0.0-final",


// If your module is going to be registered in the Vert.x module registry you will also need the following
// mandatory fields
"description":"Put description of your module here",
Expand Down
21 changes: 21 additions & 0 deletions src/main/scala/com/mycompany/myproject/ScalaPingVerticle.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.mycompany.myproject

import org.vertx.scala.platform.Verticle
import org.vertx.scala.core.eventbus.Message

/**
* ScalaPing Verticle
* Octavio Luna
*
*/

class ScalaPingVerticle extends Verticle{
override def start(){
val log = container.logger
vertx.eventBus.registerHandler("ping-address", {message:Message[String] =>
message.reply("pong!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the intendation is wrong somehow. Usually, Vert.x uses 2 spaces everywhere.

log info "Sent back pong scala!"
})

}
}