Quick Question on the SDKs: Is it possible to use ...
# support
b
Quick Question on the SDKs: Is it possible to use the Batch API(like https://www.rudderstack.com/docs/api/http-api/#batch) in the Ruby SDK?
m
Hey There! 👋 Your message has been received by the RudderStack team. We will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
b
Does every SDK have to support Batch separately, or do they inherit it from the HTTP APIs?
each event added to a queue - it pulls to send in batches
m
Yes all APIs support the batch method. Thanks @hundreds-lifeguard-65770
b
Thanks for confirming. I tried to go through the codebase for the SDK, and wanted to confirm whether my understanding here seems correct?
Copy code
require 'rudder-sdk-ruby'

# Initialize the RudderStack client
config = {
  write_key: 'YOUR_WRITE_KEY',
  data_plane_url: 'YOUR_DATA_PLANE_URL',
  max_queue_size: 2,  # Assuming this configures the batch size
  # other configuration options...
}
rudderstack_client = Rudder::Analytics.new(config)

# Queue events (they will be batched automatically based on the max_queue_size)
rudderstack_client.track(userId: 'user_123', event: 'Uninstall Event', properties: {/* event properties... */})
rudderstack_client.track(userId: 'user_456', event: 'Expired Subscription', properties: {/* event properties... */})

# The SDK should handle the batching and sending of these events automatically
Does this make sense?
h
correct
b
Thank you @hundreds-lifeguard-65770 🙏