I have a pretty simple task that I need to complete, but it's taken up several days trying to find out how to do it because I can't find any documentation on managed remoting on the server side...
Basically, I have setup Managed Remoting using a flex client, and it works flawlessly, but I need the server to be able to manipulate the managed entities as well. I want a thread to run on the server that updates the entites in real time based upon a feed coming in from an external server. If I communicate with the managed remoting service class directly from another java class it persists fine, but it does not update the clients because I am unable to figure out how to pass in a ManagedRemotingMessage to the Managed Remoting service.
Can anyone explain how I can tell my MR service that an entity with ID x needs to commit a change to property y? It seems like a fairly simple task, and I've tried everything I can find thus far, but nothing seems to get the job done...
my server setup is very simple, just a few entity classes, a hibernate DAO, and a class annotated as such:
@ManagedRemoteService(managedEntities = {com.petzent.agentmonitor.objects.Agent.class}, destinationId="agentService", channels = { "RTMP" })
(and then the appropriate CRUD annotations on the various methods in the class, of course)
As far as how to interface with that class from another Java class, I won't even bother posting my code because I don't even know where to begin...
Views
Replies
Total Likes
Consider using the ManagedRemotingContext class. It provides ability to submit CRUD operations to Assembler. Take a look at its javadoc at: http://help.adobe.com/en_US/dataservicesjee/4.6/APIReference/flex/data/ManagedRemotingContext.html.
Rohit
That would be ideal, but I can't get the current context from ManagedRemotingContextImpl.getCurrent(), it simply returns null. The only time I am able to get the context successfully is when the Flex client calls the service.
This leads me to believe that the problem lies in how I'm communicating with the class. For good measure, let me show you my classes:
@ManagedRemoteService(managedEntities = {com.petzent.agentmonitor.objects.Agent.class}, destinationId="agentService", channels = { "RTMP" })
public class AgentMonitorService
{
public AgentDAO aDAO;
public AgentMonitorService()
{
aDAO = AgentDAO.getInstance();
}
/**
* Agent Management
*/
@Create
public String createAgent(Agent agent)
{
aDAO.createAgent(agent);
return "Created new agent";
}
@Get
public Agent getAgent(Integer agentId)
{
return aDAO.getAgent(agentId);
}
@Update
public void updateAgent(Agent agent)
{
ManagedRemotingContext context = ManagedRemotingContextImpl.getCurrent();
aDAO.updateAgent(agent);
}
@Delete
public void deleteAgent(Agent agent)
{
aDAO.deleteAgent(agent);
}
}
Okay, pretty simple service. Now, I've tried several methods of interfacing with it directly:
None of these allow me to grab the current context using ManagedRemotingContextImpl.getCurrent(). In fact, the only time I have ever been able to retrieve the context is when I call the service directly from my Flex client...
Views
Replies
Total Likes
I think someone from your team is already in touch with us. We will provide you an example for how to achieve this.
Rohit
haha, yea thats me. Appreciate it!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies