File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -97,26 +97,26 @@ The following sample code demonstrates this use case.
97
97
``` python
98
98
from mercury.system.objstream import ObjectStreamIO
99
99
# create a new stream with 60 seconds inactivity expiry
100
- out = ObjectStreamIO(expiry_seconds = 60 )
101
- out .write(' hello world 1' )
102
- out .write(' hello world 2' )
100
+ producer = ObjectStreamIO(expiry_seconds = 60 )
101
+ producer .write(' hello world 1' )
102
+ producer .write(' hello world 2' )
103
103
# signal EOF so the input stream generator will finish
104
- out .send_eof()
104
+ producer .send_eof()
105
105
106
106
# the producer should obtain the stream_id and send it to the consumer
107
- stream_id = out .get_route()
107
+ stream_id = producer .get_route()
108
108
109
109
# the consumer will open the existing stream with the stream_id
110
- in = ObjectStreamIO(route = stream_id, expiry_seconds = 60 )
110
+ consumer = ObjectStreamIO(route = stream_id, expiry_seconds = 60 )
111
111
try :
112
112
# set a 10 seconds read timeout for the input stream generator
113
- for i in in .read(10 ):
113
+ for i in consumer .read(10 ):
114
114
print (i)
115
115
except TimeoutError as te:
116
116
# you may retry reading from the generator again if you want to wait for more input
117
117
118
118
# close and release the stream
119
- in .close()
119
+ consumer .close()
120
120
```
121
121
122
122
### Broadcast
You can’t perform that action at this time.
0 commit comments