Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Cepheus-CEP multitenancy issue for multiple subscription #76

Open
pooja1pathak opened this issue Oct 17, 2018 · 1 comment
Open

Cepheus-CEP multitenancy issue for multiple subscription #76

pooja1pathak opened this issue Oct 17, 2018 · 1 comment
Labels
help wanted multitenancy Support for Fiware-Service and Fiware-ServicePath

Comments

@pooja1pathak
Copy link
Contributor

I have enabled the multi-tenant profile from application.properties:
spring.profiles.active=multi-tenant

and then uploaded config file as:

POST cepheus:8080/v1/admin/config
Fiware-Service: testservice
Fiware-ServicePath: /testservicepath

{
  "host":"http://localhost:8080",
  "in":[
      ...
      "providers":[
      	{ 
          "url":"http://localhost:1026",
          "serviceName": "testprovider",
          "servicePath": "/test"
        }
      ],
      ...
   ]
  "out":[
      ...
      "brokers":[
        {
          "url":"http://localhost:1026",
          "serviceName": "testbroker",
          "servicePath": "/test"
        }
      ]
   ]
}

A JSON file having name cep-testservice-testservicepath is created as a result of the above request.

Then I uploaded another config file as:

POST cepheus:8080/v1/admin/config
Fiware-Service: testservicenew
Fiware-ServicePath: /testservicepathnew

{
  "host":"http://localhost:8080",
  "in":[
      ...
      "providers":[
      	{ 
          "url":"http://localhost:1026",
          "serviceName": "testprovidernew",
          "servicePath": "/testnew"
        }
      ],
      ...
   ]
  "out":[
      ...
      "brokers":[
        {
          "url":"http://localhost:1026",
          "serviceName": "testbrokernew",
          "servicePath": "/testnew"
        }
      ]
   ]
}

A JSON file having name cep-testservicenew-testservicepathnew is created as a result of the above request.

As per my understanding of multi-tenant Cepheu-CEP, it should store both configuration file and subscriptions.

But according to my observation, Cepheus-CEP stores both the configuration file but does not stores both subscription. It handles only one subscription at a time.
Whenever new configuration is uploaded to Cepheus-CEP, it first unsubscribes the previous subscription from orion and then subscribe orion with the new configuration. Which can be seen in the below logs:

2018-10-17 11:58:44.946  INFO 20984 --- [nio-8080-exec-5] c.o.cepheus.cep.EsperEventProcessor      : Apply configuration
2018-10-17 11:58:44.947  INFO 20984 --- [nio-8080-exec-5] c.o.cepheus.cep.EsperEventProcessor      : Add new event type: EventType{id='Test1', type='Test', isPattern=false, attributes=[Attribute{name='CO2Level', type='int', metadata=[], jsonpath='null'}]}
2018-10-17 11:58:44.947  INFO 20984 --- [nio-8080-exec-5] c.o.cepheus.cep.EsperEventProcessor      : Add new event type: EventType{id='Test1', type='Alert', isPattern=false, attributes=[Attribute{name='CO2Level', type='int', metadata=[], jsonpath='null'}]}
2018-10-17 11:58:44.947  INFO 20984 --- [nio-8080-exec-5] c.o.cepheus.cep.EsperEventProcessor      : Add new statement: INSERT INTO Alert SELECT * FROM Test WHERE CO2Level > 20
2018-10-17 11:58:44.947 DEBUG 20984 --- [nio-8080-exec-5] c.e.e.c.service.EPAdministratorHelper    : .createEPLStmt statementName=null eplStatement=INSERT INTO Alert SELECT * FROM Test WHERE CO2Level > 20
2018-10-17 11:58:44.947 DEBUG 20984 --- [nio-8080-exec-5] c.espertech.esper.epl.parse.ParseHelper  : .parse Parsing expr=INSERT INTO Alert SELECT * FROM Test WHERE CO2Level > 20
2018-10-17 11:58:44.948 DEBUG 20984 --- [nio-8080-exec-5] c.e.esper.epl.parse.Antlr4ErrorListener  : reportAttemptingFullContext
2018-10-17 11:58:44.949 DEBUG 20984 --- [nio-8080-exec-5] c.e.esper.epl.parse.Antlr4ErrorListener  : reportAmbiguity
2018-10-17 11:58:44.949 DEBUG 20984 --- [nio-8080-exec-5] c.espertech.esper.epl.parse.ParseHelper  : .parse Dumping AST...
2018-10-17 11:58:44.950 DEBUG 20984 --- [nio-8080-exec-5] c.espertech.esper.epl.parse.ParseHelper  : .walk Walking AST using walker com.espertech.esper.epl.parse.EPLTreeWalkerListener
2018-10-17 11:58:44.950 DEBUG 20984 --- [nio-8080-exec-5] c.e.e.c.s.StatementResultServiceImpl     : .ctor
2018-10-17 11:58:44.950 DEBUG 20984 --- [nio-8080-exec-5] c.e.esper.filter.FilterSpecCompiler      : .makeFilterSpec spec=FilterSpecCompiled type=com.espertech.esper.event.map.MapEventType@f944f4b parameters=[[Lcom.espertech.esper.filter.FilterSpecParam;@14a4a5]
2018-10-17 11:58:44.950 DEBUG 20984 --- [nio-8080-exec-5] c.e.e.c.s.StatementLifecycleSvcImpl      : .start Starting statement 6d5018bb-725d-4bf4-a644-839c6cce0042 from desc=com.espertech.esper.core.service.StatementLifecycleSvcImpl$EPStatementDesc@728b97be
2018-10-17 11:58:44.950 DEBUG 20984 --- [nio-8080-exec-5] c.e.e.c.s.StatementLifecycleSvcImpl      : .startInternal Starting statement 6d5018bb-725d-4bf4-a644-839c6cce0042 from desc=com.espertech.esper.core.service.StatementLifecycleSvcImpl$EPStatementDesc@728b97be
2018-10-17 11:58:44.950 DEBUG 20984 --- [nio-8080-exec-5] c.e.esper.view.ViewServiceHelper         : .addMergeViews Incoming specifications=[]
2018-10-17 11:58:44.950 DEBUG 20984 --- [nio-8080-exec-5] c.e.esper.view.ViewServiceHelper         : .addMergeViews Outgoing specifications=[]
2018-10-17 11:58:44.950 DEBUG 20984 --- [nio-8080-exec-5] c.e.e.e.c.OrderByProcessorFactoryFactory : .getProcessor Using no OrderByProcessor
2018-10-17 11:58:44.950 DEBUG 20984 --- [nio-8080-exec-5] e.e.e.c.ResultSetProcessorFactoryFactory : .getProcessor Using no result processor
2018-10-17 11:58:44.950 DEBUG 20984 --- [nio-8080-exec-5] c.e.e.view.stream.StreamFactorySvcImpl   : .createStream hashCode=-1539986878 filter=FilterSpecCompiled type=com.espertech.esper.event.map.MapEventType@f944f4b parameters=[[Lcom.espertech.esper.filter.FilterSpecParam;@14a4a5]
2018-10-17 11:58:44.951 DEBUG 20984 --- [nio-8080-exec-5] c.espertech.esper.view.ViewServiceImpl   : .createView No new views created, dumping stream ... com.espertech.esper.view.ZeroDepthStreamNoIterate@379a44
2018-10-17 11:58:44.951 DEBUG 20984 --- [nio-8080-exec-5] c.e.e.core.service.EPAdministratorImpl   : .createEPLStmt Statement created and started
2018-10-17 11:58:44.951 DEBUG 20984 --- [nio-8080-exec-5] c.e.e.c.s.StatementLifecycleSvcImpl      : .updatedListeners No action for base implementation
2018-10-17 11:58:44.951 DEBUG 20984 --- [nio-8080-exec-5] c.o.cepheus.cep.SubscriptionManager      : Unsubscribe from http://<orion>:1026 for 5bc6d5b2b2b093eb19f1aeef
2018-10-17 11:58:44.951 DEBUG 20984 --- [nio-8080-exec-5] o.s.web.client.AsyncRestTemplate         : Created asynchronous POST request for "http://<orion>:1026/ngsi10/unsubscribeContext"
2018-10-17 11:58:44.951 DEBUG 20984 --- [nio-8080-exec-5] o.s.web.client.RestTemplate              : Setting request Accept header to [application/xml, text/xml, application/json, application/*+xml, application/*+json]
2018-10-17 11:58:44.951 DEBUG 20984 --- [nio-8080-exec-5] o.s.web.client.RestTemplate              : Writing [com.orange.ngsi.model.UnsubscribeContext@2e2fdb9b] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@1027cbcc]
2018-10-17 11:58:44.952 DEBUG 20984 --- [nio-8080-exec-5] o.a.http.impl.nio.client.MainClientExec  : [exchange: 9] start execution
2018-10-17 11:58:44.952 DEBUG 20984 --- [nio-8080-exec-5] o.a.h.client.protocol.RequestAddCookies  : CookieSpec selected: default
2018-10-17 11:58:44.952 DEBUG 20984 --- [nio-8080-exec-5] o.a.h.client.protocol.RequestAuthCache   : Auth cache not set in the context
2018-10-17 11:58:44.952 DEBUG 20984 --- [nio-8080-exec-5] o.a.h.i.n.c.InternalHttpAsyncClient      : [exchange: 9] Request connection for {}->http://<orion>:1026
2018-10-17 11:58:44.952 DEBUG 20984 --- [nio-8080-exec-5] .n.c.PoolingNHttpClientConnectionManager : Connection request: [route: {}->http://<orion>:1026][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
2018-10-17 11:58:44.952 DEBUG 20984 --- [nio-8080-exec-5] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-0 <cep>:62454<-><orion>:1026[ACTIVE][r:r]: Set timeout 0
2018-10-17 11:58:44.952 DEBUG 20984 --- [nio-8080-exec-5] .n.c.PoolingNHttpClientConnectionManager : Connection leased: [id: http-outgoing-0][route: {}->http://<orion>:1026][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
2018-10-17 11:58:44.952 DEBUG 20984 --- [nio-8080-exec-5] o.a.h.i.n.c.InternalHttpAsyncClient      : [exchange: 9] Connection allocated: CPoolProxy{http-outgoing-0 [ACTIVE]}
2018-10-17 11:58:44.952 DEBUG 20984 --- [nio-8080-exec-5] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-0 <orion>:62454<-><orion>:1026[ACTIVE][r:r]: Set attribute http.nio.exchange-handler
2018-10-17 11:58:44.952 DEBUG 20984 --- [/O dispatcher 1] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-0 [ACTIVE] Request ready
2018-10-17 11:58:44.952 DEBUG 20984 --- [/O dispatcher 1] o.a.h.i.n.c.InternalHttpAsyncClient      : Connection route already established
2018-10-17 11:58:44.952 DEBUG 20984 --- [/O dispatcher 1] o.a.http.impl.nio.client.MainClientExec  : [exchange: 9] Attempt 1 to execute request
2018-10-17 11:58:44.952 DEBUG 20984 --- [/O dispatcher 1] o.a.http.impl.nio.client.MainClientExec  : Target auth state: UNCHALLENGED
2018-10-17 11:58:44.952 DEBUG 20984 --- [/O dispatcher 1] o.a.http.impl.nio.client.MainClientExec  : Proxy auth state: UNCHALLENGED
2018-10-17 11:58:44.952 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 >> POST /ngsi10/unsubscribeContext HTTP/1.1
2018-10-17 11:58:44.952 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 >> Accept: application/json
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 >> Content-Type: application/json
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 >> Fiware-Service: testprovider
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 >> Fiware-ServicePath: /test
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 >> Content-Length: 45
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 >> Host: <orion>:1026
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 >> Connection: Keep-Alive
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 >> User-Agent: Apache-HttpAsyncClient/4.1 (Java/1.8.0_181)
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-0 <cep>:62454<-><orion>:1026[ACTIVE][rw:w]: Event set [w]
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-0 [ACTIVE] Output ready
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] o.a.http.impl.nio.client.MainClientExec  : [exchange: 9] produce content
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] o.a.http.impl.nio.client.MainClientExec  : [exchange: 9] Request completed
2018-10-17 11:58:44.953 DEBUG 20984 --- [nio-8080-exec-5] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-0 <cep>:62454<-><orion>:1026[ACTIVE][rw:w]: Event set [w]
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-0 [ACTIVE] [content length: 45; pos: 45; completed: true]
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-0 <cep>:62454<-><orion>:1026[ACTIVE][rw:w]: 331 bytes written
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "POST /ngsi10/unsubscribeContext HTTP/1.1[\r][\n]"
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "Accept: application/json[\r][\n]"
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "Content-Type: application/json[\r][\n]"
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "Fiware-Service: testprovider[\r][\n]"
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "Fiware-ServicePath: /test[\r][\n]"
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "Content-Length: 45[\r][\n]"
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "Host: <orion>:1026[\r][\n]"
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
2018-10-17 11:58:44.953 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "User-Agent: Apache-HttpAsyncClient/4.1 (Java/1.8.0_181)[\r][\n]"
2018-10-17 11:58:44.953  INFO 20984 --- [nio-8080-exec-5] c.o.c.cep.persistence.JsonPersistence    : Save configuration in C:\Users\<user>\AppData\Local\Temp\/cep-testservicenew-testservicepathnew.json
2018-10-17 11:58:44.953  INFO 20984 --- [taskScheduler-1] c.o.cepheus.cep.SubscriptionManager      : Launch of the periodic subscription task at 2018-10-17T06:28:44.953Z
2018-10-17 11:58:44.954 DEBUG 20984 --- [taskScheduler-1] c.o.cepheus.cep.SubscriptionManager      : Subscribe to http://<orion>:1026 for SubscribeContext{entityIdList=[EntityId{id='Test1', type='Test', isPattern=false}], attributeList=[CO2Level]}
2018-10-17 11:58:44.954 DEBUG 20984 --- [taskScheduler-1] o.s.web.client.AsyncRestTemplate         : Created asynchronous POST request for "http://<orion>:1026/ngsi10/subscribeContext"
2018-10-17 11:58:44.955 DEBUG 20984 --- [taskScheduler-1] o.s.web.client.RestTemplate              : Setting request Accept header to [application/xml, text/xml, application/json, application/*+xml, application/*+json]
2018-10-17 11:58:44.955 DEBUG 20984 --- [taskScheduler-1] o.s.web.client.RestTemplate              : Writing [SubscribeContext{entityIdList=[EntityId{id='Test1', type='Test', isPattern=false}], attributeList=[CO2Level]}] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@1027cbcc]
2018-10-17 11:58:44.955 DEBUG 20984 --- [taskScheduler-1] o.a.http.impl.nio.client.MainClientExec  : [exchange: 10] start execution
2018-10-17 11:58:44.955 DEBUG 20984 --- [taskScheduler-1] o.a.h.client.protocol.RequestAddCookies  : CookieSpec selected: default
2018-10-17 11:58:44.955 DEBUG 20984 --- [taskScheduler-1] o.a.h.client.protocol.RequestAuthCache   : Auth cache not set in the context
2018-10-17 11:58:44.955 DEBUG 20984 --- [taskScheduler-1] o.a.h.i.n.c.InternalHttpAsyncClient      : [exchange: 10] Request connection for {}->http://<orion>:1026
2018-10-17 11:58:44.955 DEBUG 20984 --- [taskScheduler-1] .n.c.PoolingNHttpClientConnectionManager : Connection request: [route: {}->http://<orion>:1026][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "[\r][\n]"
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 >> "{"subscriptionId":"5bc6d5b2b2b093eb19f1aeef"}"
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-0 <cep>:62454<-><orion>:1026[ACTIVE][r:w]: Event cleared [w]
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-0 <cep>:62454<-><orion>:1026[ACTIVE][r:r]: 282 bytes read
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 << "HTTP/1.1 200 OK[\r][\n]"
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 << "Connection: Keep-Alive[\r][\n]"
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 << "Content-Length: 93[\r][\n]"
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 << "Content-Type: application/json[\r][\n]"
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 << "Fiware-Correlator: f0b12754-d1d5-11e8-b7ad-0298bb5d193c[\r][\n]"
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 << "Date: Wed, 17 Oct 2018 06:29:03 GMT[\r][\n]"
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 << "[\r][\n]"
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.wire                     : http-outgoing-0 << "{"subscriptionId":"5bc6d5b2b2b093eb19f1aeef","statusCode":{"code":"200","reasonPhrase":"OK"}}"
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 << HTTP/1.1 200 OK
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 << Connection: Keep-Alive
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 << Content-Length: 93
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 << Content-Type: application/json
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 << Fiware-Correlator: f0b12754-d1d5-11e8-b7ad-0298bb5d193c
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] org.apache.http.headers                  : http-outgoing-0 << Date: Wed, 17 Oct 2018 06:29:03 GMT
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-0 [ACTIVE(93)] Response received
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] o.a.http.impl.nio.client.MainClientExec  : [exchange: 9] Response received HTTP/1.1 200 OK
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-0 [ACTIVE(93)] Input ready
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] o.a.http.impl.nio.client.MainClientExec  : [exchange: 9] Consume content
2018-10-17 11:58:44.957 DEBUG 20984 --- [/O dispatcher 1] o.a.h.i.n.c.InternalHttpAsyncClient      : [exchange: 9] Connection can be kept alive indefinitely
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] o.a.http.impl.nio.client.MainClientExec  : [exchange: 9] Response processed
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] o.a.h.i.n.c.InternalHttpAsyncClient      : [exchange: 9] releasing connection
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-0 <cep>:62454<-><orion>:1026[ACTIVE][r:r]: Remove attribute http.nio.exchange-handler
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] .n.c.PoolingNHttpClientConnectionManager : Releasing connection: [id: http-outgoing-0][route: {}->http://<orion>:1026][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] .n.c.PoolingNHttpClientConnectionManager : Connection [id: http-outgoing-0][route: {}->http://<orion>:1026] can be kept alive indefinitely
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-0 <cep>:62454<-><orion>:1026[ACTIVE][r:r]: Set timeout 0
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] .n.c.PoolingNHttpClientConnectionManager : Connection released: [id: http-outgoing-0][route: {}->http://<orion>:1026][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] o.s.web.client.AsyncRestTemplate         : Async POST request for "http://<orion>:1026/ngsi10/unsubscribeContext" resulted in 200 (OK)
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] o.s.web.client.RestTemplate              : Reading [class com.orange.ngsi.model.UnsubscribeContextResponse] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@1027cbcc]
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] c.o.cepheus.cep.SubscriptionManager      : Unsubscribe response for 5bc6d5b2b2b093eb19f1aeef: 200
2018-10-17 11:58:44.958 DEBUG 20984 --- [/O dispatcher 1] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-0 [ACTIVE] [content length: 93; pos: 93; completed: true]
2018-10-17 11:58:44.959 DEBUG 20984 --- [/O dispatcher 2] .n.c.PoolingNHttpClientConnectionManager : Connection leased: [id: http-outgoing-1][route: {}->http://<orion>:1026][total kept alive: 1; route allocated: 2 of 2; total allocated: 2 of 20]
2018-10-17 11:58:44.959 DEBUG 20984 --- [/O dispatcher 2] o.a.h.i.n.c.InternalHttpAsyncClient      : [exchange: 10] Connection allocated: CPoolProxy{http-outgoing-1 [ACTIVE]}
2018-10-17 11:58:44.959 DEBUG 20984 --- [/O dispatcher 2] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-1 <cep>:63334<-><orion>:1026[ACTIVE][r:]: Set attribute http.nio.exchange-handler
2018-10-17 11:58:44.959 DEBUG 20984 --- [/O dispatcher 2] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-1 <cep>:63334<-><orion>:1026[ACTIVE][rw:]: Event set [w]
2018-10-17 11:58:44.959 DEBUG 20984 --- [/O dispatcher 2] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-1 <cep>:63334<-><orion>:1026[ACTIVE][rw:]: Set timeout 0
2018-10-17 11:58:44.959 DEBUG 20984 --- [/O dispatcher 2] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-1 [ACTIVE]: Connected
2018-10-17 11:58:44.959 DEBUG 20984 --- [/O dispatcher 2] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-1 <cep>:63334<-><orion>:1026[ACTIVE][rw:]: Set attribute http.nio.http-exchange-state
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] o.a.h.i.n.c.InternalHttpAsyncClient      : Start connection routing
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] o.a.http.impl.nio.client.MainClientExec  : Connection route established
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] o.a.http.impl.nio.client.MainClientExec  : [exchange: 10] Attempt 1 to execute request
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] o.a.http.impl.nio.client.MainClientExec  : Target auth state: UNCHALLENGED
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] o.a.http.impl.nio.client.MainClientExec  : Proxy auth state: UNCHALLENGED
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 >> POST /ngsi10/subscribeContext HTTP/1.1
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 >> Accept: application/json
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 >> Content-Type: application/json
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 >> Fiware-Service: testprovidernew
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 >> Fiware-ServicePath: /testnew
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 >> Content-Length: 191
2018-10-17 11:58:44.960 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 >> Host: <orion>:1026
2018-10-17 11:58:44.961 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 >> Connection: Keep-Alive
2018-10-17 11:58:44.961 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 >> User-Agent: Apache-HttpAsyncClient/4.1 (Java/1.8.0_181)
2018-10-17 11:58:44.962 DEBUG 20984 --- [/O dispatcher 2] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-1 <cep>:63334<-><orion>:1026[ACTIVE][rw:]: Event set [w]
2018-10-17 11:58:44.962 DEBUG 20984 --- [/O dispatcher 2] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-1 [ACTIVE] Output ready
2018-10-17 11:58:44.962 DEBUG 20984 --- [/O dispatcher 2] o.a.http.impl.nio.client.MainClientExec  : [exchange: 10] produce content
2018-10-17 11:58:44.962 DEBUG 20984 --- [/O dispatcher 2] o.a.http.impl.nio.client.MainClientExec  : [exchange: 10] Request completed
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-1 [ACTIVE] [content length: 191; pos: 191; completed: true]
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-1 <cep>:63334<-><orion>:1026[ACTIVE][rw:w]: 482 bytes written
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "POST /ngsi10/subscribeContext HTTP/1.1[\r][\n]"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "Accept: application/json[\r][\n]"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "Content-Type: application/json[\r][\n]"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "Fiware-Service: testprovidernew[\r][\n]"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "Fiware-ServicePath: /testnew[\r][\n]"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "Content-Length: 191[\r][\n]"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "Host: <orion>:1026[\r][\n]"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "User-Agent: Apache-HttpAsyncClient/4.1 (Java/1.8.0_181)[\r][\n]"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "[\r][\n]"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 >> "{"reference":"http://<cep>:8080/ngsi10/notifyContext","duration":"PT1H","entities":[{"id":"Test1","type":"Test","isPattern":"false"}],"attributes":["CO2Level"],"notifyConditions":null}"
2018-10-17 11:58:44.963 DEBUG 20984 --- [/O dispatcher 2] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-1 <cep>:63334<-><orion>:1026[ACTIVE][r:w]: Event cleared [w]
2018-10-17 11:58:44.964 DEBUG 20984 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
2018-10-17 11:58:44.964 DEBUG 20984 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Successfully completed request
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-1 <cep>:63334<-><orion>:1026[ACTIVE][r:r]: 274 bytes read
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 << "HTTP/1.1 200 OK[\r][\n]"
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 << "Connection: Keep-Alive[\r][\n]"
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 << "Content-Length: 85[\r][\n]"
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 << "Content-Type: application/json[\r][\n]"
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 << "Fiware-Correlator: f0b2b358-d1d5-11e8-aa34-0298bb5d193c[\r][\n]"
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 << "Date: Wed, 17 Oct 2018 06:29:03 GMT[\r][\n]"
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 << "[\r][\n]"
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.wire                     : http-outgoing-1 << "{"subscribeResponse":{"subscriptionId":"5bc6d6afb2b093eb19f1aef0","duration":"PT1H"}}"
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 << HTTP/1.1 200 OK
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 << Connection: Keep-Alive
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 << Content-Length: 85
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 << Content-Type: application/json
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 << Fiware-Correlator: f0b2b358-d1d5-11e8-aa34-0298bb5d193c
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] org.apache.http.headers                  : http-outgoing-1 << Date: Wed, 17 Oct 2018 06:29:03 GMT
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-1 [ACTIVE(85)] Response received
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] o.a.http.impl.nio.client.MainClientExec  : [exchange: 10] Response received HTTP/1.1 200 OK
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-1 [ACTIVE(85)] Input ready
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] o.a.http.impl.nio.client.MainClientExec  : [exchange: 10] Consume content
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] o.a.h.i.n.c.InternalHttpAsyncClient      : [exchange: 10] Connection can be kept alive indefinitely
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] o.a.http.impl.nio.client.MainClientExec  : [exchange: 10] Response processed
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] o.a.h.i.n.c.InternalHttpAsyncClient      : [exchange: 10] releasing connection
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-1 <cep>:63334<-><orion>:1026[ACTIVE][r:r]: Remove attribute http.nio.exchange-handler
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] .n.c.PoolingNHttpClientConnectionManager : Releasing connection: [id: http-outgoing-1][route: {}->http://<orion>:1026][total kept alive: 1; route allocated: 2 of 2; total allocated: 2 of 20]
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] .n.c.PoolingNHttpClientConnectionManager : Connection [id: http-outgoing-1][route: {}->http://<orion>:1026] can be kept alive indefinitely
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] h.i.n.c.ManagedNHttpClientConnectionImpl : http-outgoing-1 <cep>:63334<-><orion>:1026[ACTIVE][r:r]: Set timeout 0
2018-10-17 11:58:45.012 DEBUG 20984 --- [/O dispatcher 2] .n.c.PoolingNHttpClientConnectionManager : Connection released: [id: http-outgoing-1][route: {}->http://<orion>:1026][total kept alive: 2; route allocated: 2 of 2; total allocated: 2 of 20]
2018-10-17 11:58:45.026 DEBUG 20984 --- [/O dispatcher 2] o.s.web.client.AsyncRestTemplate         : Async POST request for "http://<orion>:1026/ngsi10/subscribeContext" resulted in 200 (OK)
2018-10-17 11:58:45.027 DEBUG 20984 --- [/O dispatcher 2] o.s.web.client.RestTemplate              : Reading [class com.orange.ngsi.model.SubscribeContextResponse] as "application/json" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@1027cbcc]
2018-10-17 11:58:45.027 DEBUG 20984 --- [/O dispatcher 2] c.o.cepheus.cep.SubscriptionManager      : Subscription done for http://<orion>:1026
2018-10-17 11:58:45.027 DEBUG 20984 --- [/O dispatcher 2] o.a.h.i.nio.client.InternalIODispatch    : http-outgoing-1 [ACTIVE] [content length: 85; pos: 85; completed: true]

Should it be concluded that the function for handling subscription needs be improved for multi-tenant cepheus-CEP so that it can handle multiple subscriptions for multiple config files?

@marcc-orange
Copy link
Contributor

NGSI subscriptions are statefull which we considered was a really bad design decision (other pub/sub protocols like MQTT have "session" subscriptions that only lives while the connections between the two backends are "alive". So we tried to find a way to implement a subscription mechanism without having to handle persistance of the subscriptions.
This is why when the CEP always tries to unsubcribe when configuration is update and when it receives a notification for a entity it is not subscribed to anymore, it will automatically send an unsubscribe event.

@marcc-orange marcc-orange added help wanted multitenancy Support for Fiware-Service and Fiware-ServicePath labels Oct 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted multitenancy Support for Fiware-Service and Fiware-ServicePath
Projects
None yet
Development

No branches or pull requests

2 participants