lib/fluent/plugin/azureeventhubs/http.rb in sk-fluent-plugin-azureeventhubs-0.0.21 vs lib/fluent/plugin/azureeventhubs/http.rb in sk-fluent-plugin-azureeventhubs-0.0.23
- old
+ new
@@ -2,10 +2,11 @@
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
@@ -44,12 +45,11 @@
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", Yajl::Encoder.encode(payload),
+ RestClient.post("#{@uri.to_s}?timeout=10&api-version=2014-01", payload.to_json,
{ 'Content-Type' => 'application/atom+xml;type=entry;charset=utf-8',
'Authorization' => token
})
end
end