Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
titlepyHelloComp/src/ws/HelloComponentImpl.py
linenumberstrue
collapsetrue
#Client# Client stubs and definitions, such as structs, enums, etc.
import workshop
#Skeleton# Skeleton infrastructure for server implementation
import workshop__POA
 
#Base# Base component implementation
from Acspy.Servants.ACSComponent import ACSComponent
#Services# Services provided by the container to the component
from Acspy.Servants.ContainerServices import ContainerServices
#Basic# Basic component lifecycle (initialize, execute, cleanUp and aboutToAbort methods)
from Acspy.Servants.ComponentLifecycle import ComponentLifecycle
 
class HelloComponentImpl(workshop__POA.HelloComponent, ACSComponent, ContainerServices, ComponentLifecycle):
    def __init__(self):
        ACSComponent.__init__(self)
        ContainerServices.__init__(self)
        self._logger = self.getLogger()
    def printHello(self):
        print("Just printing 'Hello World!'")
        return "Hello World!"

...

First launch your acs container with the good modified ACS _CDB (If you want to component to start with the container).CDB

Code Block
languagebash
titleStart container
acsStartContainer -py aragornContainer
acsStartContainer -java frodoContainer
acsStartContainer -cpp bilboContainer

For simplicity, we implement a simple client in Python to communicate with the 3 programming languages:

Code Block
languagepy
linenumberstrue
collapsetrue
from Acspy.Clients.SimpleClient import PySimpleClient

client = PySimpleClient()

hc_py = client.getComponent("PY_HELLO_COMP")
print(hc_java = client.getComponent("JAVA_HELLO_COMP")py.printHello())

hc_cppjava = client.getComponent("CPPJAVA_HELLO_COMP")

print(hc_pyjava.printHello())

print(hc_java.printHello())cpp = client.getComponent("CPP_HELLO_COMP")
print(hc_cpp.printHello())

Output

The output is seen on each container:

...