1234567891011121314151617181920212223242526272829 |
- /*
- * mycoagent.c
- *
- * This is an example agent that showcases the use of mycorrhiza.
- */
- #include "../src/myco-agent.c"
- int main() {
- char *agent_name = "DOMAIN1_MYAGENT";
- int agent_message_queue_id = myco_agent_register(agent_name);
- // MYCO create
- // #MYCO create("RESOURCE_1", 1024, transactional)
- char *resource_name = "RESOURCE_1";
- int resource_size = 1024;
- void *resource_pointer = myco_agent_register_resource(agent_message_queue_id, agent_name, resource_name, RESOURCE_TRANSACTIONAL, getpid(), resource_size);
- // View available resources
- myco_agent_request_resource_list(agent_message_queue_id);
- printf("Sleeping for 30 seconds...\n");
- sleep(30);
- // At the end of its runtime the agent unregisters with the daemon.
- myco_agent_unregister(agent_name, agent_message_queue_id);
- return EXIT_SUCCESS;
- }
|