11import importlib
2+ from typing import Any , List , Optional , Union , Tuple
23from iop ._business_host import _BusinessHost
34
45class _BusinessOperation (_BusinessHost ):
5- """ This class corresponds to the PEX framework EnsLib.PEX.BusinessOperation class.
6- The EnsLib.PEX.BusinessOperation RemoteClassName property identifies the Python class with the business operation implementation.
7- The business operation can optionally use an adapter to handle the outgoing message. Specify the adapter in the OutboundAdapter property.
8- If the business operation has an adapter, it uses the adapter to send the message to the external system.
9- The adapter can either be a PEX adapter or an ObjectScript adapter.
6+ """Business operation component that handles outbound communication.
7+
8+ Responsible for sending messages to external systems. Can optionally use an
9+ adapter to handle the outbound messaging protocol.
1010 """
1111
12- DISPATCH = []
13- Adapter = adapter = None
12+ DISPATCH : List [Tuple [str , str ]] = []
13+ Adapter : Any = None
14+ adapter : Any = None
1415
15- def on_message (self , request ):
16- """ Called when the business operation receives a message from another production component.
17- Typically, the operation will either send the message to the external system or forward it to a business process or another business operation.
18- If the operation has an adapter, it uses the Adapter.invoke() method to call the method on the adapter that sends the message to the external system.
19- If the operation is forwarding the message to another production component, it uses the SendRequestAsync() or the SendRequestSync() method
20-
21- Parameters:
22- request: An instance of either a subclass of Message or of IRISObject containing the incoming message for the business operation.
16+ def on_message (self , request : Any ) -> Any :
17+ """Handle incoming messages.
18+
19+ Process messages received from other production components and either
20+ send to external system or forward to another component.
2321
22+ Args:
23+ request: The incoming message
24+
2425 Returns:
25- The response object
26+ Response message
2627 """
2728 return self .OnMessage (request )
2829
29- def on_keepalive (self ):
30+ def on_keepalive (self ) -> None :
3031 """
31- > This function is called when the server sends a keepalive message
32+ Called when the server sends a keepalive message.
3233 """
3334 return
3435
35- def _set_iris_handles (self , handle_current , handle_partner ) :
36- """ For internal use only. """
36+ def _set_iris_handles (self , handle_current : Any , handle_partner : Any ) -> None :
37+ """For internal use only."""
3738 self .iris_handle = handle_current
3839 if type (handle_partner ).__module__ .find ('iris' ) == 0 :
3940 if handle_partner ._IsA ("Grongier.PEX.OutboundAdapter" ) or handle_partner ._IsA ("IOP.OutboundAdapter" ):
@@ -42,20 +43,20 @@ def _set_iris_handles(self, handle_current, handle_partner):
4243 self .Adapter = self .adapter = handle_partner
4344 return
4445
45- def _dispatch_on_init (self , host_object ) :
46- """ For internal use only. """
46+ def _dispatch_on_init (self , host_object : Any ) -> None :
47+ """For internal use only."""
4748 self ._create_dispatch ()
4849 self .on_init ()
4950 return
5051
5152 @_BusinessHost .input_deserialzer
5253 @_BusinessHost .output_serialzer
53- def _dispatch_on_message (self , request ) :
54- """ For internal use only. """
54+ def _dispatch_on_message (self , request : Any ) -> Any :
55+ """For internal use only."""
5556 return self ._dispach_message (request )
5657
57- def OnMessage (self , request ) :
58- """ DEPRECATED : use on_message
58+ def OnMessage (self , request : Any ) -> Any :
59+ """DEPRECATED : use on_message
5960 Called when the business operation receives a message from another production component.
6061 Typically, the operation will either send the message to the external system or forward it to a business process or another business operation.
6162 If the operation has an adapter, it uses the Adapter.invoke() method to call the method on the adapter that sends the message to the external system.
@@ -67,4 +68,4 @@ def OnMessage(self, request):
6768 Returns:
6869 The response object
6970 """
70- return
71+ return
0 commit comments