@Service public class NgsiClient extends Object
| Modifier and Type | Field and Description |
|---|---|
org.springframework.web.client.AsyncRestTemplate |
asyncRestTemplate |
org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager |
poolingNHttpClientConnectionManager |
ProtocolRegistry |
protocolRegistry |
| Constructor and Description |
|---|
NgsiClient() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.http.HttpHeaders |
getRequestHeaders()
The default HTTP request headers used for the requests.
|
org.springframework.http.HttpHeaders |
getRequestHeaders(String url)
The default HTTP request headers, depends on the host supporting xml or json
|
org.springframework.util.concurrent.ListenableFuture<NotifyContextResponse> |
notifyContext(String url,
org.springframework.http.HttpHeaders httpHeaders,
NotifyContext notifyContext)
Send an notify request
|
org.springframework.util.concurrent.ListenableFuture<NotifyContextResponse> |
notifyContextCustomURL(String customURL,
org.springframework.http.HttpHeaders httpHeaders,
NotifyContext notifyContext)
Send an notify request to a custom URL
|
org.springframework.util.concurrent.ListenableFuture<QueryContextResponse> |
queryContext(String url,
org.springframework.http.HttpHeaders httpHeaders,
QueryContext queryContext)
Send an query request
|
org.springframework.util.concurrent.ListenableFuture<RegisterContextResponse> |
registerContext(String url,
org.springframework.http.HttpHeaders httpHeaders,
RegisterContext registerContext)
Send an register request
|
protected <T,U> org.springframework.util.concurrent.ListenableFuture<T> |
request(org.springframework.http.HttpMethod method,
String url,
org.springframework.http.HttpHeaders httpHeaders,
U body,
Class<T> responseType)
Make an HTTP request
|
protected <T,U> org.springframework.util.concurrent.ListenableFuture<T> |
request(String url,
org.springframework.http.HttpHeaders httpHeaders,
U body,
Class<T> responseType)
Default POST request
|
void |
shutdownGracefully()
Let some time for the client to shutdown gracefully
|
org.springframework.util.concurrent.ListenableFuture<SubscribeContextResponse> |
subscribeContext(String url,
org.springframework.http.HttpHeaders httpHeaders,
SubscribeContext subscribeContext)
Send a subscription request
|
org.springframework.util.concurrent.ListenableFuture<UnsubscribeContextResponse> |
unsubscribeContext(String url,
org.springframework.http.HttpHeaders httpHeaders,
String subscriptionId)
Send an unsubscription request
|
org.springframework.util.concurrent.ListenableFuture<UpdateContextResponse> |
updateContext(String url,
org.springframework.http.HttpHeaders httpHeaders,
UpdateContext updateContext)
Send an update request
|
org.springframework.util.concurrent.ListenableFuture<UpdateContextSubscriptionResponse> |
updateContextSubscription(String url,
org.springframework.http.HttpHeaders httpHeaders,
UpdateContextSubscription updateContextSubscription)
Send a update subscription request
|
@Autowired public org.springframework.web.client.AsyncRestTemplate asyncRestTemplate
@Autowired public org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager poolingNHttpClientConnectionManager
@Autowired public ProtocolRegistry protocolRegistry
public void shutdownGracefully()
throws IOException
IOExceptionpublic org.springframework.util.concurrent.ListenableFuture<UpdateContextResponse> updateContext(String url, org.springframework.http.HttpHeaders httpHeaders, UpdateContext updateContext)
url - the URL of the brokerhttpHeaders - the HTTP header to use, or null for defaultupdateContext - the UpdateContextpublic org.springframework.util.concurrent.ListenableFuture<SubscribeContextResponse> subscribeContext(String url, org.springframework.http.HttpHeaders httpHeaders, SubscribeContext subscribeContext)
url - the URL of the subscription providerhttpHeaders - the HTTP header to use, or null for defaultsubscribeContext - the SubscriptionContextpublic org.springframework.util.concurrent.ListenableFuture<UpdateContextSubscriptionResponse> updateContextSubscription(String url, org.springframework.http.HttpHeaders httpHeaders, UpdateContextSubscription updateContextSubscription)
url - the URL of the subscription providerhttpHeaders - the HTTP header to use, or null for defaultupdateContextSubscription - the UpdateContextSubscriptionpublic org.springframework.util.concurrent.ListenableFuture<UnsubscribeContextResponse> unsubscribeContext(String url, org.springframework.http.HttpHeaders httpHeaders, String subscriptionId)
url - the URL of the subscription providerhttpHeaders - the HTTP header to use, or null for defaultsubscriptionId - the subscription ID to unsubscribepublic org.springframework.util.concurrent.ListenableFuture<NotifyContextResponse> notifyContext(String url, org.springframework.http.HttpHeaders httpHeaders, NotifyContext notifyContext)
url - the URL of the subscription providerhttpHeaders - the HTTP header to use, or null for defaultnotifyContext - the notifyContextpublic org.springframework.util.concurrent.ListenableFuture<NotifyContextResponse> notifyContextCustomURL(String customURL, org.springframework.http.HttpHeaders httpHeaders, NotifyContext notifyContext)
customURL - the URL to notifyhttpHeaders - the HTTP header to use, or null for defaultnotifyContext - the notifyContextpublic org.springframework.util.concurrent.ListenableFuture<QueryContextResponse> queryContext(String url, org.springframework.http.HttpHeaders httpHeaders, QueryContext queryContext)
url - the URL of the registration providerhttpHeaders - the HTTP header to use, or null for defaultqueryContext - the queryContextpublic org.springframework.util.concurrent.ListenableFuture<RegisterContextResponse> registerContext(String url, org.springframework.http.HttpHeaders httpHeaders, RegisterContext registerContext)
url - the URL of the registration consumerhttpHeaders - the HTTP header to use, or null for defaultregisterContext - the registerContextpublic org.springframework.http.HttpHeaders getRequestHeaders()
public org.springframework.http.HttpHeaders getRequestHeaders(String url)
url - protected <T,U> org.springframework.util.concurrent.ListenableFuture<T> request(String url, org.springframework.http.HttpHeaders httpHeaders, U body, Class<T> responseType)
Copyright © 2016 Orange. All rights reserved.