How to merge entities received from AsyncMessage topic into client EntityManager

13 views
Skip to first unread message

Cory Showers

unread,
Sep 19, 2014, 1:24:53 PM9/19/14
to gran...@googlegroups.com
Granite 3.1.0GA
JavaFX 8 

I'm trying to do something a little unorthodox with DataPublisher.   Basically instead of using DataPublisher to publish new Entities when they are persisted. I'm publishing new entities using Gravity AsyncMessage and I'm no longer handling new entities with the TideApplicationEvent.Persist event on client.   This seem to work fine except for now when the entity is updated on Server it no longer reflects automatically on client.    I suspect because there are 2 instances of the entity on client.  One received from the AsyncMessage topic and now showing on the blotter, and the other entity published from DataObserver in user context map.   Is there a way to merge whatever I get from AsyncMessage and put it in the DataContext?    The EntityManager has a few methods called mergeExternal, sounds like what I need but not sure if it is.

The reason I'm looking to do it this way is because I don't have any control over sending additional information to client when entities are persisted.  Using the old way I had to wait until client has the persisted entity then make another call to server to get additional information for the blotter.


Cory Showers

unread,
Sep 19, 2014, 1:33:55 PM9/19/14
to gran...@googlegroups.com
I think I figured it out.  entityManager.mergeExternalData(entity) did the trick.    I wasn't using the return value so thats why it didn't work before.
Reply all
Reply to author
Forward
0 new messages