lib/fluent/plugin/azureeventhubs/http.rb in sk-fluent-plugin-azureeventhubs-0.0.19 vs lib/fluent/plugin/azureeventhubs/http.rb in sk-fluent-plugin-azureeventhubs-0.0.21
- old
+ new
@@ -2,11 +2,10 @@
class AzureEventHubsHttpSender
def initialize(connection_string, hub_name, expiry=3600,proxy_addr='',proxy_port=3128,open_timeout=60,read_timeout=60)
require 'openssl'
require 'base64'
require 'rest-client'
- require 'json'
require 'cgi'
require 'time'
@connection_string = connection_string
@hub_name = hub_name
@expiry_interval = expiry
@@ -45,11 +44,12 @@
def send(payload)
send_w_properties(payload, nil)
end
def send_w_properties(payload, properties)
+ require 'yajl'
token = generate_sas_token(@uri.to_s)
- RestClient.post("#{@uri.to_s}?timeout=10&api-version=2014-01", payload.to_json,
+ RestClient.post("#{@uri.to_s}?timeout=10&api-version=2014-01", Yajl::Encoder.encode(payload),
{ 'Content-Type' => 'application/atom+xml;type=entry;charset=utf-8',
'Authorization' => token
})
end
end