Provider Server¶
HTTP Server to route message requests to message producer function.
Attributes¶
handler_function = sys.argv[2]
module-attribute
¶
handler_module = sys.argv[1]
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
produce_message_url = sys.argv[3]
module-attribute
¶
set_provider_state_url = sys.argv[6]
module-attribute
¶
state_provider_function = sys.argv[5]
module-attribute
¶
state_provider_module = sys.argv[4]
module-attribute
¶
Classes¶
Provider(handler_module: str, handler_function: str, produce_message_url: str, state_provider_module: str, state_provider_function: str, set_provider_state_url: str)
¶
Provider class to route message requests to message producer function.
Sets up three endpoints
- /_test/ping: A simple ping endpoint for testing.
- /produce_message: Route message requests to the handler function.
- /set_provider_state: Set the provider state.
The specific produce_message
and set_provider_state
URLs can be configured
with the produce_message_url
and set_provider_state_url
arguments.
PARAMETER | DESCRIPTION |
---|---|
handler_module |
The name of the module containing the handler function.
TYPE:
|
handler_function |
The name of the handler function.
TYPE:
|
produce_message_url |
The URL to route message requests to the handler function.
TYPE:
|
state_provider_module |
The name of the module containing the state provider setup function.
TYPE:
|
state_provider_function |
The name of the state provider setup function.
TYPE:
|
set_provider_state_url |
The URL to set the provider state.
TYPE:
|
Source code in examples/tests/v3/provider_server.py
Attributes¶
app = flask.Flask('Provider')
instance-attribute
¶
handler_function = getattr(import_module(handler_module), handler_function)
instance-attribute
¶
produce_message_url = produce_message_url
instance-attribute
¶
set_provider_state_url = set_provider_state_url
instance-attribute
¶
state_provider_function = getattr(import_module(state_provider_module), state_provider_function)
instance-attribute
¶
Functions¶
run() -> None
¶
Start the provider.
Source code in examples/tests/v3/provider_server.py
Functions¶
start_provider(**kwargs: str) -> Generator[URL, None, None]
¶
Start the provider app.
Expects kwargs to to contain the following
Source code in examples/tests/v3/provider_server.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
|