class Multiwoven::Integrations::Destination::Http::Client
def write(sync_config, records, _action = "create")
def write(sync_config, records, _action = "create") connection_config = sync_config.destination.connection_specification.with_indifferent_access url = connection_config[:destination_url] headers = connection_config[:headers] write_success = 0 write_failure = 0 records.each_slice(MAX_CHUNK_SIZE) do |chunk| payload = create_payload(chunk) response = Multiwoven::Integrations::Core::HttpClient.request( url, sync_config.stream.request_method, payload: payload, headers: headers ) if success?(response) write_success += chunk.size else write_failure += chunk.size end rescue StandardError => e handle_exception(e, { context: "HTTP:RECORD:WRITE:EXCEPTION", type: "error", sync_id: sync_config.sync_id, sync_run_id: sync_config.sync_run_id }) write_failure += chunk.size end tracker = Multiwoven::Integrations::Protocol::TrackingMessage.new( success: write_success, failed: write_failure ) tracker.to_multiwoven_message rescue StandardError => e handle_exception(e, { context: "HTTP:RECORD:WRITE:EXCEPTION", type: "error", sync_id: sync_config.sync_id, sync_run_id: sync_config.sync_run_id }) end