File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1717# https://www.confluent.io/blog/[path-to-blog-post] 
1818
1919# Example Siege [https://github.com/JoeDog/siege] test: 
20- # siege -c 400 -r 200 'http://localhost:8000/items1 POST {"name":"testuser"}' 
20+ # $  siege -c 400 -r 200 'http://localhost:8000/items1 POST {"name":"testuser"}' 
2121
2222import  asyncio 
2323import  confluent_kafka 
@@ -46,6 +46,9 @@ def close(self):
4646        self ._poll_thread .join ()
4747
4848    def  produce (self , topic , value ):
49+         """ 
50+         An awaitable produce method. 
51+         """ 
4952        result  =  self ._loop .create_future ()
5053
5154        def  ack (err , msg ):
@@ -57,6 +60,10 @@ def ack(err, msg):
5760        return  result 
5861
5962    def  produce2 (self , topic , value , on_delivery ):
63+         """ 
64+         A produce method in which delivery notifications are made available 
65+         via both the returned future and on_delivery callback (if specified). 
66+         """ 
6067        result  =  self ._loop .create_future ()
6168
6269        def  ack (err , msg ):
@@ -167,4 +174,4 @@ async def create_item5(item: Item):
167174
168175
169176if  __name__  ==  '__main__' :
170-     uvicorn .run (app , host = '0 .0.0.0 ' , port = 8000 )
177+     uvicorn .run (app , host = '127 .0.0.1 ' , port = 8000 )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments