小编Krz*_*zyH的帖子

在Akka/Spray上阻止HTTP请求

我在Scala中使用Akka actor从外部服务(HTTP get请求)下载资源.外部服务的响应是JSON,我必须使用分页(提供程序非常慢).我想在10个线程中同时下载所有分页结果.我使用这样的URL来下载块:http://service.com/itmes? limit = 50& offset = 1000

我创建了以下管道:

ScatterActor => RoundRobinPool[10](LoadChunkActor) => Aggreator
Run Code Online (Sandbox Code Playgroud)

ScatterActor获取要下载的项目的总数,并将其划分为块.我创建了10个LoadChunkActor来同时处理任务.

  override def receive: Receive = {
    case LoadMessage(limit) =>
    val offsets: IndexedSeq[Int] = 0 until limit by chunkSize
    offsets.foreach(offset => context.system.actorSelection(pipe) !
    LoadMessage(chunkSize, offset))
 }
Run Code Online (Sandbox Code Playgroud)

LoadChunkActor使用Spray发送请求.演员看起来像这样:

val pipeline = sendReceive ~> unmarshal[List[Items]]
override def receive: Receive = {
  case LoadMessage(limit, offset) =>
    val uri: String = s"http://service.com/items?limit=50&offset=$offset"
    val responseFuture = pipeline {Get(uri)}
    responseFuture onComplete {
      case Success(items) => aggregator ! Loaded(items) …
Run Code Online (Sandbox Code Playgroud)

scala akka spray-client

10
推荐指数
1
解决办法
1311
查看次数

在Gradle 1.0中使用插件应用程序时提供自己的脚本

我使用Gradle 1.0构建我的项目,我想使用该application插件来创建应用程序分发包.

而不是生成的启动脚本,我想提供自己的.

如何跳过CreateStartScripts任务?

gradle

5
推荐指数
1
解决办法
1984
查看次数

OtrosLogViewer出错

我正在使用OtrosLogViewer来分析我的glassfish日志文件.但似乎软件无效.我认为我的模式是错误的.

type=log4j
customLevels=SEVERE=FATAL,WARNING=WARN,CONFIG=INFO,FINE=DEBUG,FINER=TRACE,FINEST=TRACE,INFO=INFO
pattern=[#|TIMESTAMP|LEVEL|PROP(ProductName-Version)|LOGGER|_ThreadID=PROP(ThreadID);_ThreadName=THREAD;PROP(Properties);|MESSAGE|#]
dateFormat=yyyy-MM-dd'T'HH:mm:ss.SSSZ
name=GlassFish logger
charset=UTF-8
Run Code Online (Sandbox Code Playgroud)

这是我的服务器日志示例(Glassfish 4.0):

[2013-10-13T17:36:03.841+0700] [glassfish 4.0] [WARNING] [endpoint.activation.failure] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.inbound] [tid: _ThreadID=34 _ThreadName=admin-listener(1)] [timeMillis: 1381660563841] [levelValue: 900] [[
RAR8501: Exception during endpoint activation for ra [ jmsra ], activationSpecClass [ com.sun.messaging.jms.ra.ActivationSpec ] : javax.resource.ResourceException: MQRA:EC:Invalid destinationLookup jms/NewMessage configured in ActivationSpec of MDB for no JNDI name found]]

[2013-10-13T17:36:03.841+0700] [glassfish 4.0] [SEVERE] [containers.mdb.create_container_exception] [javax.enterprise.system.container.ejb.mdb.org.glassfish.ejb.mdb] [tid: _ThreadID=34 _ThreadName=admin-listener(1)] [timeMillis: 1381660563841] [levelValue: 1000] [[
MDB00017: [NewMessage]: Exception in creating message-driven bean container: [java.lang.Exception]]]
Run Code Online (Sandbox Code Playgroud)

如何修改我的模式使其工作?我对OtrosLogViewer的模式很困惑.

谢谢.

glassfish log-analysis logfile otroslogviewer

2
推荐指数
1
解决办法
852
查看次数