rabbah commented on a change in pull request #2218: Port Controller from Spray
to Akka
URL:
https://github.com/apache/incubator-openwhisk/pull/2218#discussion_r132842737
##########
File path: core/controller/src/main/scala/whisk/core/controller/Triggers.scala
##########
@@ -173,16 +173,20 @@ trait WhiskTriggersApi extends WhiskCollectionAPI {
Path.SingleSlash +
rule.action.name.asString
}
}.toString
-
val actionUrl = Path("/api/v1") /
"namespaces" / actionNamespace / "actions"
+ val request = HttpRequest(
+ method = POST,
+ uri = url.withPath(actionUrl +
actionPath),
+ headers =
List(Authorization(BasicHttpCredentials(user.authkey.uuid.asString,
user.authkey.key.asString))),
+ entity =
HttpEntity(MediaTypes.`application/json`,
args.getOrElse(JsObject()).compactPrint))
- pipeline(Post(url.withPath(actionUrl +
actionPath), args)) onComplete {
- case Success(o) =>
- logging.info(this, s"successfully
invoked ${rule.action} -> ${o.fields("activationId")}")
- case Failure(usr:
UnsuccessfulResponseException) if usr.response.status == StatusCodes.NotFound =>
+ Http().singleRequest(request).map {
+ case HttpResponse(StatusCodes.OK,
headers, entity, _) =>
+ logging.info(this, s"successfully
invoked ${rule.action} -> ")
Review comment:
also looks like something is not quite right here - even after firing the
trigger correctly, inspecting the controller logs shows:
```
[2017-08-13T13:48:32.233Z] [WARN] [#tid_7] [TriggersApi] action guest/a
could not be invoked due to Source(SourceShape(StatefulMapConcat.out),
CompositeModule [3c60a25e] Name: iterableSource Modules: (singleSource)
GraphStage(SingleSource(List(ByteString(123, 34, 97, 99, 116, 105, 118, 97,
116, 105, 111, 110, 73, 100, 34, 58, 34, 98, 97, 53, 99, 57, 51, 55, 102, 51,
97, 57, 101, 52, 48, 56, 52, 56, 98, 49, 102, 100, 54, 99, 53, 54, 54, 52, 55,
48, 100, 50, 50, 34, 125)))) [41c5bf50] (unnamed) [703a0c97] copy of
GraphStage(StatefulMapConcat) [50915aa5] Downstreams: single.out ->
StatefulMapConcat.in Upstreams: StatefulMapConcat.in -> single.out MatValue:
Atomic(singleSource[41c5bf50]))
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services