问题
I use Cepheus GE for my use case and I enabled it in the multi tenant mode and uploaded my config.json
file to it, But when I start to send updates to the Cepheus broker in order to forward them to the CEP, the Cepheus broker just receives the updates but doesn't forward them to the Cepheus cap as it couldn't recognize the service and service-path that are set in the config.json
. And when I tried to send my updates directly to the Cepheus-CEP, it accepted them and processed them successfully. So I wonder why the Cepheus broker cannot recognize the Fiware-service when it's enabled in the multi tenant mode.
the config file service definition is as follows
"brokers":[
{
"url":"http://XXX.XX.XX.XX:1026",
"serviceName": "f",
"servicePath": "/f",
"authToken": "XXX"
}
]
this is the Logs of Cepheus broker.
2017-09-02 08:55:32,546 [/O dispatcher 1] WARN c.o.c.b.c.NgsiController - NotifyContext failed for http://localhost:8080/ngsi10/notifyContext$
2017-09-02 09:05:33,358 [nio-8081-exec-1] WARN c.o.c.b.c.NgsiController - UpdateContext failed for http://localhost:8082: Connection refused
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_72-internal]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_72-internal]
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:173) ~[httpcore-nio-4.4.1.$
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:147) ~[httpcore-nio-4.4.1$
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:350) ~[httpcore-nio-4.4.1.j$
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:191) ~[httpasync$
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64) ~[httpasyncclient-4.1.jar!$
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_72-internal]
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_72-internal]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_72-internal]
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:173) ~[httpcore-nio-4.4.1.$
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:147) ~[httpcore-nio-4.4.1$
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:350) ~[httpcore-nio-4.4.1.j$
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:191) ~[httpasync$
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64) ~[httpasyncclient-4.1.jar!$
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_72-internal]
2017-09-02 09:33:12,316 [pool-2-thread-1] WARN c.o.c.b.c.NgsiController - UpdateContext failed for http://localhost:8082: Connection refused
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_72-internal]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_72-internal]
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvent(DefaultConnectingIOReactor.java:173) [httpcore-nio-4.4.1.j$
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:147) [httpcore-nio-4.4.1.$
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(AbstractMultiworkerIOReactor.java:350) ~[httpcore-nio-4.4.1.j$
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.execute(PoolingNHttpClientConnectionManager.java:191) ~[httpasync$
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64) ~[httpasyncclient-4.1.jar!$
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_72-internal]
And the script file that sends the updates is as follows
(curl XXX.XXX.XXX.XXX:8081/v1/updateContext/ -s -S --header 'Content-Type: application/json' --header "Fiware-Service: f" --header "Fiware-ServicePath:/f " --header 'Accept: application/json' -d @- | python -mjson.tool ) <<EOF
{ "contextElements": [
{
"type": "Lab",
"isPattern": "false",
"id": "Lab111",
"attributes": [
{
"name": "priority",
"type": "double",
"value": "1"
},
{
"name": "controller",
"type": "string",
"value": "Controller111"
}
]
}
],
"updateAction": "UPDATE"
}
EOF
Now please I want to know where the problem could be?
回答1:
As of today, the Fiware-Cepheus broker does not support multi-tenant requests (using Fiware-Service
and Fiware-ServicePath
headers), only the CEP can handle multi-tenancy. More generally, the broker has very few features compared to a full-fledge broker like Orion.
If you need a multi-tenant broker, use the Orion Context Broker: https://fiware-orion.readthedocs.io/en/master/user/multitenancy/index.html
来源:https://stackoverflow.com/questions/46012933/error-cepheus-broker-not-forwards-updates-to-cepheus-cep