autogen/samples/apps/cap/py/demo/SimpleActorDemo.py
Rajan 1002882f01
[CAP] [Feature] Get list of actors from directory service. (#2073)
* Search directory for list of actors using regex '.*' gets all actors

* docs changes

* pre-commit fixes

* Use ActorInfo from protobuf

* pre-commit

* Added zmq tests to work on removing sleeps

* minor refactor of zmq tests

* 1) Change DirSvr to user Broker.  2) Add req-router to broker 3) In ActorConnector use handshake and req/resp to remove sleep

* 1) Change DirSvr to user Broker.  2) Add req-router to broker 3) In ActorConnector use handshake and req/resp to remove sleep

* move socket creation to thread with recv

* move socket creation to thread with recv

* Better logging for DirectorySvc

* better logging for directory svc

* Use logging config

* Start removing sleeps

* pre-commit

* Cleanup monitor socket
2024-03-27 22:14:39 +00:00

25 lines
713 B
Python

import time
from AppAgents import GreeterAgent
from autogencap.LocalActorNetwork import LocalActorNetwork
def simple_actor_demo():
"""
Demonstrates the usage of the CAP platform by registering an actor, connecting to the actor,
sending a message, and performing cleanup operations.
"""
# CAP Platform
network = LocalActorNetwork()
# Register an actor
network.register(GreeterAgent())
# Tell actor to connect to other actors
network.connect()
# Get a channel to the actor
greeter_link = network.lookup_actor("Greeter")
# Send a message to the actor
greeter_link.send_txt_msg("Hello World!")
# Cleanup
greeter_link.close()
network.disconnect()