![](/img/trans.png)
[英]Send Orion Context Broker 0.13.0 entities to Cosmos using Cygnus
[英]how to combine multiple orion entities to one ckan dataset using cygnus?
現在我正在嘗試使用所有實體信息為我的orion數據創建數據集。 我設置正確,當一些數據更改orion向天鵝座發送通知然后,天鵝座將數據添加到ckan。 如圖中所示。
問題是天鵝座為每個實體創造了一個ckan資源。 我該怎么做才能讓天鵝座將所有數據只放在一個資源中? 謝謝。
編輯1:
我剛剛發現我可以通過在orion中只進行一次訂閱來簡化。
{
"entities": [
{
"type": "Room",
"isPattern": "true",
"id": "Room.*"
}
] ...
然后我注意到天鵝座中的分組功能( http://fiware-cygnus.readthedocs.io/en/develop/installation_and_administration_guide/grouping_rules_conf/index.html )但是現在我因為天鵝座不想加載我的分組而丟失了配置文件。 它顯示了這個錯誤:
time=2016-05-03T05:32:29.658CDT | lvl=INFO | trans= | srv= | subsrv= | function=<init> | comp=Cygnus | msg=com.telefonica.iot.cygnus.interceptors.GroupingRules[58] : No grouping rules have been read
Exception in thread "Thread-1" java.lang.NullPointerException
at java.io.File.<init>(File.java:277)
at com.telefonica.iot.cygnus.interceptors.GroupingInterceptor$ConfigurationReader.run(GroupingInterceptor.java:244)
在我的代理配置文件中,我有:
cygnusagent.sources.http-source.interceptors.gi.gropuing_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf
在grouping_rules.conf中:
{
"grouping_rules": [
{
"id": 1,
"fields": [
"entityId"
],
"regex": "room.*",
"destination": "Rooms",
"fiware_service_path": "/myhouse"
}
]
}
編輯2:
我有所有的文件說:
cygnusagent.sources = http-source
cygnusagent.sinks = ckan-sink
cygnusagent.channels = ckan-channel
cygnusagent.sources.http-source.channels = ckan-channel
cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource
cygnusagent.sources.http-source.port = 5050
cygnusagent.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.OrionRestHandler
cygnusagent.sources.http-source.handler.notification_target = /notify
cygnusagent.sources.http-source.handler.default_service = test
cygnusagent.sources.http-source.handler.default_service_path = /myhouse
cygnusagent.sources.http-source.handler.events_ttl = 5
cygnusagent.sources.http-source.interceptors = ts gi
cygnusagent.sources.http-source.interceptors.ts.type = timestamp
cygnusagent.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.GroupingInterceptor$Builder
cygnusagent.sources.http-source.interceptors.gi.gropuing_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf
cygnusagent.channels.ckan-channel.type = memory
cygnusagent.channels.ckan-channel.capacity = 1000
cygnusagent.channels.ckan-channel.transactionCapacity = 100
# ============================================
# OrionCKANSink configuration
# channel name from where to read notification events
cygnusagent.sinks.ckan-sink.channel = ckan-channel
# sink class, must not be changed
cygnusagent.sinks.ckan-sink.type = com.telefonica.iot.cygnus.sinks.OrionCKANSink
# true if the grouping feature is enabled for this sink, false otherwise
cygnusagent.sinks.ckan-sink.enable_grouping = true
# true if lower case is wanted to forced in all the element names, false otherwise
cygnusagent.sinks.hdfs-sink.enable_lowercase = false
# the CKAN API key to use
cygnusagent.sinks.ckan-sink.api_key = 436fffc8-b397-478a-92fd-bbc5ffaf8269
# the FQDN/IP address for the CKAN API endpoint
cygnusagent.sinks.ckan-sink.ckan_host = ckan-demo.ckan.io
# the port for the CKAN API endpoint
cygnusagent.sinks.ckan-sink.ckan_port = 80
# Orion URL used to compose the resource URL with the convenience operation URL to query it
cygnusagent.sinks.ckan-sink.orion_url = http://localhost:1026
# how the attributes are stored, either per row either per column (row, column)
cygnusagent.sinks.ckan-sink.attr_persistence = column
# enable SSL for secure Http transportation; 'true' or 'false'
cygnusagent.sinks.ckan-sink.ssl = false
# number of notifications to be included within a processing batch
cygnusagent.sinks.ckan-sink.batch_size = 100
# timeout for batch accumulation
cygnusagent.sinks.ckan-sink.batch_timeout = 60
# number of retries upon persistence error
cygnusagent.sinks.ckan-sink.batch_ttl = 10
文件權限對我來說似乎沒問題:
[root@VM013cen-Prod conf]# ls *.conf -l
-rwxrwxrwx 1 cygnus cygnus 2675 may 3 06:45 agent_test.conf
-rwxrwxrwx 1 cygnus cygnus 258 may 3 05:08 grouping_rules.conf
-rwxr-xr-x 1 cygnus cygnus 135 mar 1 02:50 krb5_login.conf
測試可以:
Results :
Tests run: 80, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:05.862s
[INFO] Finished at: Tue May 03 06:53:44 CDT 2016
[INFO] Final Memory: 41M/105M
[INFO] ------------------------------------------------------------------------
我使用的啟動命令: /usr/cygnus/bin/cygnus-flume-ng agent --conf /usr/cygnus/conf/ -f /usr/cygnus/conf/agent_test.conf -n cygnusagent -Dflume.root.logger=INFO,console
是的,您是對的,分組規則旨在實現您描述的用例。 因此,通過定義一個簡單的規則,正則表達式匹配所有實體的類型(假設這種類型總是相同的)應該做的伎倆; 或者使用匹配實體ID的公共部分的正則表達式(如您所建議的)。
然而,您的問題似乎與分組規則本身有關。 你說你的配置包含:
cygnusagent.sources.http-source.interceptors.gi.gropuing_rules_conf_file = /usr/cygnus/conf/grouping_rules.conf
你可以在那行之前確認你有這樣的東西嗎?
cygnus-ngsi.sources.http-source.interceptors = ts gi
cygnus-ngsi.sources.http-source.interceptors.ts.type = timestamp
cygnus-ngsi.sources.http-source.interceptors.gi.type = com.telefonica.iot.cygnus.interceptors.GroupingInterceptor$Builder
另外,你能查看/usr/cygnus/conf/grouping_rules.conf
的權限嗎? 也許運行Cygnus的用戶無法讀取它。
關於規則,新的FIWARE服務路徑應該以/
開頭,因為所有FIWARE服務路徑必須以斜杠開頭(我認為這在上一版本中沒有正確記錄)。
HTH!
編輯1 :
我想我已經找到了問題。 uing...", while the correct one is "...grouping..." :) 配置的參數名稱是“...格羅 uing ......‘而正確的一項’... ...分組” :)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.