|
10 | 10 | from sqlmodel import Session, create_engine |
11 | 11 | from workflows.transport.pika_transport import PikaTransport |
12 | 12 |
|
13 | | -import murfey.server.api.auth |
14 | | -import murfey.server.api.bootstrap |
15 | | -import murfey.server.api.clem |
16 | | -import murfey.server.api.display |
17 | | -import murfey.server.api.file_io_frontend |
18 | | -import murfey.server.api.file_io_instrument |
19 | | -import murfey.server.api.hub |
20 | | -import murfey.server.api.instrument |
21 | | -import murfey.server.api.mag_table |
22 | | -import murfey.server.api.processing_parameters |
23 | | -import murfey.server.api.prometheus |
24 | | -import murfey.server.api.session_control |
25 | | -import murfey.server.api.session_info |
26 | | -import murfey.server.api.websocket |
27 | | -import murfey.server.api.workflow |
28 | 13 | from murfey.server.murfey_db import url |
| 14 | +from murfey.server.run import _set_up_transport |
29 | 15 | from murfey.util.config import security_from_file |
30 | 16 |
|
31 | 17 |
|
@@ -104,6 +90,23 @@ def handle_dlq_messages(messages_path: list[Path], rabbitmq_credentials: Path): |
104 | 90 |
|
105 | 91 | def handle_failed_posts(messages_path: list[Path], murfey_db: Session): |
106 | 92 | """Deal with any messages that have been sent as failed client posts""" |
| 93 | + # These imports need to happen after transport object is configured |
| 94 | + import murfey.server.api.auth |
| 95 | + import murfey.server.api.bootstrap |
| 96 | + import murfey.server.api.clem |
| 97 | + import murfey.server.api.display |
| 98 | + import murfey.server.api.file_io_frontend |
| 99 | + import murfey.server.api.file_io_instrument |
| 100 | + import murfey.server.api.hub |
| 101 | + import murfey.server.api.instrument |
| 102 | + import murfey.server.api.mag_table |
| 103 | + import murfey.server.api.processing_parameters |
| 104 | + import murfey.server.api.prometheus |
| 105 | + import murfey.server.api.session_control |
| 106 | + import murfey.server.api.session_info |
| 107 | + import murfey.server.api.websocket |
| 108 | + import murfey.server.api.workflow |
| 109 | + |
107 | 110 | for json_file in messages_path: |
108 | 111 | with open(json_file, "r") as json_data: |
109 | 112 | message = json.load(json_data) |
@@ -181,6 +184,15 @@ def run(): |
181 | 184 | # Read the security config file |
182 | 185 | security_config = security_from_file(args.config) |
183 | 186 |
|
| 187 | + # Configure the transport |
| 188 | + PikaTransport().load_configuration_file(security_config.rabbitmq_credentials) |
| 189 | + _set_up_transport("PikaTransport") |
| 190 | + |
| 191 | + # Now import transport object which was set up in the above step |
| 192 | + from murfey.server import _transport_object |
| 193 | + |
| 194 | + _transport_object.feedback_queue = security_config.feedback_queue |
| 195 | + |
184 | 196 | # Purge the queue and repost/reinject any messages found |
185 | 197 | dlq_dump_path = Path(args.dir) |
186 | 198 | dlq_dump_path.mkdir(parents=True, exist_ok=True) |
|
0 commit comments