@@ -721,14 +721,16 @@ def on_sns_message(self, topic, name=None):
721721 )
722722
723723 def on_sqs_message (self , queue = None , batch_size = 1 ,
724- name = None , queue_arn = None ):
724+ name = None , queue_arn = None ,
725+ maximum_batching_window_in_seconds = 0 ):
725726 return self ._create_registration_function (
726727 handler_type = 'on_sqs_message' ,
727728 name = name ,
728729 registration_kwargs = {
729730 'queue' : queue ,
730731 'queue_arn' : queue_arn ,
731732 'batch_size' : batch_size ,
733+ 'maximum_batching_window_in_seconds' : maximum_batching_window_in_seconds
732734 }
733735 )
734736
@@ -748,23 +750,27 @@ def schedule(self, expression, name=None, description=''):
748750 )
749751
750752 def on_kinesis_record (self , stream , batch_size = 100 ,
751- starting_position = 'LATEST' , name = None ):
753+ starting_position = 'LATEST' , name = None ,
754+ maximum_batching_window_in_seconds = 0 ):
752755 return self ._create_registration_function (
753756 handler_type = 'on_kinesis_record' ,
754757 name = name ,
755758 registration_kwargs = {'stream' : stream ,
756759 'batch_size' : batch_size ,
757- 'starting_position' : starting_position },
760+ 'starting_position' : starting_position ,
761+ 'maximum_batching_window_in_seconds' : maximum_batching_window_in_seconds },
758762 )
759763
760764 def on_dynamodb_record (self , stream_arn , batch_size = 100 ,
761- starting_position = 'LATEST' , name = None ):
765+ starting_position = 'LATEST' , name = None ,
766+ maximum_batching_window_in_seconds = 0 ):
762767 return self ._create_registration_function (
763768 handler_type = 'on_dynamodb_record' ,
764769 name = name ,
765770 registration_kwargs = {'stream_arn' : stream_arn ,
766771 'batch_size' : batch_size ,
767- 'starting_position' : starting_position },
772+ 'starting_position' : starting_position ,
773+ 'maximum_batching_window_in_seconds' : maximum_batching_window_in_seconds },
768774 )
769775
770776 def route (self , path , ** kwargs ):
@@ -994,6 +1000,7 @@ def _register_on_sqs_message(self, name, handler_string, kwargs, **unused):
9941000 queue = queue ,
9951001 queue_arn = queue_arn ,
9961002 batch_size = kwargs ['batch_size' ],
1003+ maximum_batching_window_in_seconds = kwargs ['maximum_batching_window_in_seconds' ],
9971004 )
9981005 self .event_sources .append (sqs_config )
9991006
@@ -1005,6 +1012,7 @@ def _register_on_kinesis_record(self, name, handler_string,
10051012 stream = kwargs ['stream' ],
10061013 batch_size = kwargs ['batch_size' ],
10071014 starting_position = kwargs ['starting_position' ],
1015+ maximum_batching_window_in_seconds = kwargs ['maximum_batching_window_in_seconds' ],
10081016 )
10091017 self .event_sources .append (kinesis_config )
10101018
@@ -1016,6 +1024,7 @@ def _register_on_dynamodb_record(self, name, handler_string,
10161024 stream_arn = kwargs ['stream_arn' ],
10171025 batch_size = kwargs ['batch_size' ],
10181026 starting_position = kwargs ['starting_position' ],
1027+ maximum_batching_window_in_seconds = kwargs ['maximum_batching_window_in_seconds' ],
10191028 )
10201029 self .event_sources .append (ddb_config )
10211030
@@ -1460,29 +1469,35 @@ def __init__(self, name, handler_string, topic):
14601469
14611470
14621471class SQSEventConfig (BaseEventSourceConfig ):
1463- def __init__ (self , name , handler_string , queue , queue_arn , batch_size ):
1472+ def __init__ (self , name , handler_string , queue , queue_arn , batch_size ,
1473+ maximum_batching_window_in_seconds ):
14641474 super (SQSEventConfig , self ).__init__ (name , handler_string )
14651475 self .queue = queue
14661476 self .queue_arn = queue_arn
14671477 self .batch_size = batch_size
1478+ self .maximum_batching_window_in_seconds = maximum_batching_window_in_seconds
14681479
14691480
14701481class KinesisEventConfig (BaseEventSourceConfig ):
14711482 def __init__ (self , name , handler_string , stream ,
1472- batch_size , starting_position ):
1483+ batch_size , starting_position ,
1484+ maximum_batching_window_in_seconds ):
14731485 super (KinesisEventConfig , self ).__init__ (name , handler_string )
14741486 self .stream = stream
14751487 self .batch_size = batch_size
14761488 self .starting_position = starting_position
1489+ self .maximum_batching_window_in_seconds = maximum_batching_window_in_seconds
14771490
14781491
14791492class DynamoDBEventConfig (BaseEventSourceConfig ):
14801493 def __init__ (self , name , handler_string , stream_arn ,
1481- batch_size , starting_position ):
1494+ batch_size , starting_position ,
1495+ maximum_batching_window_in_seconds ):
14821496 super (DynamoDBEventConfig , self ).__init__ (name , handler_string )
14831497 self .stream_arn = stream_arn
14841498 self .batch_size = batch_size
14851499 self .starting_position = starting_position
1500+ self .maximum_batching_window_in_seconds = maximum_batching_window_in_seconds
14861501
14871502
14881503class WebsocketConnectConfig (BaseEventSourceConfig ):
0 commit comments