@@ -440,7 +440,7 @@ cdef class DataEngine(Component):
440
440
elif isinstance (command, Unsubscribe):
441
441
self ._handle_unsubscribe(client, command)
442
442
else :
443
- self ._log.error(f" Cannot handle unrecognized command {command}." )
443
+ self ._log.error(f" Cannot handle command: unrecognized {command}." )
444
444
445
445
cdef inline void _handle_subscribe(self , DataClient client, Subscribe command) except * :
446
446
if command.data_type.type == Instrument:
@@ -475,10 +475,11 @@ cdef class DataEngine(Component):
475
475
command.handler,
476
476
)
477
477
else :
478
- try :
479
- client.subscribe(command.data_type)
480
- except NotImplementedError :
481
- self ._log.error(f" Cannot subscribe to unrecognized data type {command.data_type}." )
478
+ self ._handle_subscribe_data(
479
+ client,
480
+ command.data_type,
481
+ command.handler,
482
+ )
482
483
483
484
cdef inline void _handle_unsubscribe(self , DataClient client, Unsubscribe command) except * :
484
485
if command.data_type.type == Instrument:
@@ -513,10 +514,11 @@ cdef class DataEngine(Component):
513
514
command.handler,
514
515
)
515
516
else :
516
- try :
517
- client.unsubscribe(command.data_type)
518
- except NotImplementedError :
519
- self ._log.error(f" Cannot subscribe to unrecognized data type {command.data_type}." )
517
+ self ._handle_unsubscribe_data(
518
+ client,
519
+ command.data_type,
520
+ command.handler,
521
+ )
520
522
521
523
cdef inline void _handle_subscribe_instrument(
522
524
self ,
@@ -681,8 +683,12 @@ cdef class DataEngine(Component):
681
683
682
684
if data_type not in self ._data_handlers:
683
685
# Setup handlers
686
+ try :
687
+ client.subscribe(data_type)
688
+ except NotImplementedError :
689
+ self ._log.error(f" Cannot subscribe: {client.name} has not implemented data type {data_type} subscriptions." )
690
+ return
684
691
self ._data_handlers[data_type] = [] # type: list[callable]
685
- client.subscribe(data_type)
686
692
self ._log.info(f" Subscribed to {data_type} data." )
687
693
688
694
# Add handler for subscriber
@@ -941,7 +947,7 @@ cdef class DataEngine(Component):
941
947
try :
942
948
client.request(request.data_type, request.id)
943
949
except NotImplementedError :
944
- self ._log.error(f" Cannot handle request: DataType {request.data_type} is unrecognized ." )
950
+ self ._log.error(f" Cannot handle request: unrecognized data type {request.data_type}." )
945
951
946
952
# -- DATA HANDLERS ---------------------------------------------------------------------------------
947
953
@@ -961,7 +967,7 @@ cdef class DataEngine(Component):
961
967
elif isinstance (data, Data):
962
968
self ._handle_custom_data(data)
963
969
else :
964
- self ._log.error(f" Cannot handle data: {data} is an unrecognized type: {type(data)}." )
970
+ self ._log.error(f" Cannot handle data: unrecognized type {type(data)} {data }." )
965
971
966
972
cdef inline void _handle_instrument(self , Instrument instrument) except * :
967
973
self .cache.add_instrument(instrument)
0 commit comments