How to Share a TeaObject
To share an object, use the share() method of the TeaPersistence class. Once an object is shared, it is available for other agents to use. When you share a TeaObject, you share all the references in that object too. For example, if you share a person object called Peter who has cousins (references in the object Peter) named Adam, Sarah, and Brian, when you share Peter, you effectively share objects Adam, Sarah and Brian too.
Here is a sample code which shares a TeaObject, John:
@TeaOperation(name = "sharePerson", description = "Share a Person object") public void sharePerson() throws IOException { // Person implements TeaObject and has objectTypeName="Person" in this instance the key="John" final Person person = new Person("John", "Public John Person"); //teaAgentServer is an instance of com.tibco.tea.agent.server.TeaAgentServer or com.tibco.tea.agent.server.TeaAgentServlet final TeaPersistence persistence = teaAgentServer.getPersistence(); persistence.share(person); }
Copyright © Cloud Software Group, Inc. All Rights Reserved.