Akka(6)Remote Actor - akka-sample-remote-scala
1. Installation of Akka
Download the akka_2.10-2.3.4.zip, put it in the working place.
Deploy my jar to the deploy directory.
>cp target/scala-2.10/sillycat-akka_2.10-1.0.jar /opt/akka/deploy/
The configuration file is in /opt/akka/config/application.conf
2. Find the Example
http://www.typesafe.com/platform/getstarted
After run activator I can create a sample project of remote akka with the search name of akka-sample-remote-scala
activator is really a good tool. I will try to use that later.
After that I have this project on my local akka-sample-remote-scala
And here are a lot of other examples https://github.com/akka/akka/tree/master/akka-samples
3. Implementation
Reading code from akka-sample-remote-scala
4. Deployment
Error Message
bin/akka com.sillycat.akka.server.EventServiceRemoteApp Exception in thread "main" java.lang.NoClassDefFoundError: scala/Function1 at akka.kernel.Main.main(Main.scala) Caused by: java.lang.ClassNotFoundException: scala.Function1 at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Solution:
[ -n "$AKKA_CLASSPATH" ] || AKKA_CLASSPATH="$AKKA_HOME/lib/scala-library-2.10.4.jar:$AKKA_HOME/config:$AKKA_HOME/lib/akka/*"
Finally I found that because we did not find the scala-library because of the version name. so I change it to scala-library-2.10.4.jar.
Then it runs, but it complains about some ClassNotFound Exception. So I deploy the assembly jar there.
>bin/akka com.sillycat.akka.server.EventServiceRemoteApp
It runs and the codes are in sample project sillycat-akka.
Warning Message
Successfully started Akka SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Solution:
Go the lib/akka directory
>wget http://central.maven.org/maven2/org/slf4j/slf4j-log4j12/1.7.7/slf4j-log4j12-1.7.7.jar
>rm -fr slf4j-api-1.7.5.jar
>wget http://central.maven.org/maven2/org/slf4j/slf4j-log4j12/1.7.7/slf4j-log4j12-1.7.7.jar
>mkdir install
>cd install/
>wget http://apache.mirrors.lucidnetworks.net/logging/log4j/1.2.17/log4j-1.2.17.tar.gz
>tar zxvf log4j-1.2.17.tar.gz
>cp apache-log4j-1.2.17/log4j-1.2.17.jar ../
Make sure these jars are there under lib/akka/
log4j-1.2.17.jar
slf4j-api-1.7.7.jar
slf4j-log4j12-1.7.7.jar
About the Logging Message
Running sbt in debug Level
>sbt test --debug
Actually my logging information is not showing because I am using slf4j-simple
My dependencies are as follow:
"com.typesafe" %% "scalalogging-slf4j" % "1.0.1",
"org.slf4j" % "slf4j-simple" % "1.7.7",
//"org.slf4j" % "slf4j-log4j12" % "1.7.7",
"org.slf4j" % "slf4j-api" % "1.7.7",
The configuration file should be as follow, and the file name should be simple logger.properties:
# SLF4J's SimpleLogger configuration file
# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err.
# Default logging detail level for all instances of SimpleLogger.
# Must be one of ("trace", "debug", "info", "warn", or "error").
# If not specified, defaults to "info".
org.slf4j.simpleLogger.defaultLogLevel=debug
# Logging detail level for a SimpleLogger instance named "xxxxx".
# Must be one of ("trace", "debug", "info", "warn", or "error").
# If not specified, the default logging detail level is used.
#org.slf4j.simpleLogger.log.xxxxx=
# Set to true if you want the current date and time to be included in output messages.
# Default is false, and will output the number of milliseconds elapsed since startup.
#org.slf4j.simpleLogger.showDateTime=false
# The date and time format to be used in the output messages.
# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat.
# If the format is not specified or is invalid, the default format is used.
# The default format is yyyy-MM-dd HH:mm:ss:SSS Z.
#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z
# Set to true if you want to output the current thread name.
# Defaults to true.
#org.slf4j.simpleLogger.showThreadName=true
# Set to true if you want the Logger instance name to be included in output messages.
# Defaults to true.
#org.slf4j.simpleLogger.showLogName=true
# Set to true if you want the last component of the name to be included in output messages.
# Defaults to false.
#org.slf4j.simpleLogger.showShortLogName=false
If I want the log4j working, I need to change the dependencies as follow:
"com.typesafe" %% "scalalogging-slf4j" % "1.0.1",
"org.slf4j" % "slf4j-simple" % "1.7.7",
//"org.slf4j" % "slf4j-log4j12" % "1.7.7",
"org.slf4j" % "slf4j-api" % "1.7.7",
Error Message:
[INFO] [08/11/2014 14:40:35.887] [EventServiceLocalSystem-akka.actor.default-dispatcher-2] [akka://EventServiceLocalSystem/deadLetters] Message [com.sillycat.akka.model.EventMessage] from Actor[akka://EventServiceLocalSystem/temp/$a] to Actor[akka://EventServiceLocalSystem/deadLetters] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
Error Message:
Can't serialize a non-protobuf message using protobuf
Solution:
"com.typesafe.akka" %% "akka-remote" % "2.3.4"
It is not working if I deploy to akka and run with bin/akka.
5. Another Example
Search for akka-sample-cluster-scala
References:
http://agiledon.github.io/blog/2014/02/18/remote-actor-in-akka/
http://java.dzone.com/articles/how-configure-slf4j-different
http://sillycat.iteye.com/blog/2100232
http://doc.akka.io/docs/akka/snapshot/scala/remoting.html#remote-configuration-scala
http://doc.akka.io/docs/akka/snapshot/scala/remoting.html
Serialization
http://doc.akka.io/docs/akka/snapshot/scala/serialization.html#serialization-scala
http://www.typesafe.com/activator/template/akka-sample-remote-scala?_ga=1.191183337.2134491737.1406929595
http://alvinalexander.com/scala/simple-akka-actors-remote-example
http://alvinalexander.com/scala/akka-remote-sending-objects-messages
https://github.com/alvinj/AkkaRemoteActorsHelloWorld.git
https://typesafe.com/activator/template/akka-sample-cluster-scala
http://doc.akka.io/docs/akka/2.1.2/cluster/cluster-usage-scala.html
http://tersesystems.com/2014/06/25/akka-clustering/
- 浏览: 2492636 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
发表评论
-
Update Site will come soon
2021-06-02 04:10 1618I am still keep notes my tech n ... -
NodeJS12 and Zlib
2020-04-01 07:44 435NodeJS12 and Zlib It works as ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 297Traefik 2020(1)Introduction and ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 381Private Registry 2020(1)No auth ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 342Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 424NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 369Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 300Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 214GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 399GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 283GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 274Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 268Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 256Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(1)Running with Component
2020-02-19 01:17 244Serverless with NodeJS and Tenc ... -
NodeJS MySQL Library and npmjs
2020-02-07 06:21 240NodeJS MySQL Library and npmjs ... -
Python Library 2019(1)requests and aiohttp
2019-12-18 01:12 229Python Library 2019(1)requests ... -
Hadoop Docker 2019 Version 3.2.1
2019-12-10 07:39 260Hadoop Docker 2019 Version 3.2. ... -
Nginx and Proxy 2019(1)Nginx Enable Lua and Parse JSON
2019-12-03 04:17 386Nginx and Proxy 2019(1)Nginx En ... -
Data Solution 2019(13)Docker Zeppelin Notebook and Memory Configuration
2019-11-09 07:15 248Data Solution 2019(13)Docker Ze ...
相关推荐
Scala 中的简单 Akka Remote 示例 这个存储库包含一个简单的 akka 远程示例。 它展示了如何在同一个项目中创建远程和本地 actor。它还展示了如何读取和解释不同的配置。
用Scala写的akka actor简单demo,已经打包成SBT程序,因为上传大小限制依赖包没上传,用户安装了sbt后只需要执行update命令即可
Akka是JAVA虚拟机JVM平台上构建高并发、分布式和容错应用的工具包和...Akka用Scala语言写成,同时提供了Scala和JAVA的开发接口。 Akka处理并发的方法基于Actor模型。在Akka里,Actor之间通信的唯一机制就是消息传递。
akka-actor_2.11 jar包
Akka是JAVA虚拟机JVM平台上构建高并发、分布式和容错应用的工具包和...Akka用Scala语言写成,同时提供了Scala和JAVA的开发接口。 Akka处理并发的方法基于Actor模型。在Akka里,Actor之间通信的唯一机制就是消息传递。
Akka scala 并发 actor 高清原版pdf 学习scala实现akka进行并发编程
响应式架构 消息模式Actor实现与Scala.Akka应用集成 响应式架构 消息模式Actor实现与Scala.Akka应用集成
Scala Akka项目源码
akka-actor_2.12 jar包
akka集群,scala函数式编程。
消息模式Actor实现与Scala、Akka应用集成
如果您正在测试来自 actor 的响应,您必须使用非糖的 tell 语法,以便 testActor 获取响应acotor ! (msg, testActor) acotor ! (msg, testActor)或将特征with ImplicitSender混合,以便testActor显示为测试中发送的...
akka-http-oauth2-client 带有Akka HTTP的OAuth 2.0的Scala包装器。获取akka-http-oauth2-client akka-http-oauth2-client在sonatype存储库中可用,并且以Akka HTTP 10.0.x为目标。 有兼容Scala 2.11和2.12的jar。 ...
响应式架构++消息模式Actor实现与Scala.Akka应用集成+,沃恩·弗农+
akka-js, Scala.js的Akka actor实现 但是,这个项目不被维护,另外一个项目 !目前并没有积极地开展这个项目。 在这里提供一个主动维护的到 Scala.js的端口,可以: https://github.com/unicredit/akka.js 。我们...
Akka是JAVA虚拟机JVM平台上构建高并发、分布式和容错应用的工具包和...Akka用Scala语言写成,同时提供了Scala和JAVA的开发接口。 Akka处理并发的方法基于Actor模型。在Akka里,Actor之间通信的唯一机制就是消息传递。
akka-kryo-serialization 提供了基于 Kryo 的序列化器,用于 Scala 和 Akka。可用于更高效的 akka actor 的远程访问。
响应式架构 消息模式Actor实现与Scala.Akka应用集成 高清扫描版