on 07-03-2006 2:20 PM
We need to do some preprocessing before sync can takes place. So we register the observer and do the preprocessing. The problem is and I read this on this forum:
<i>Have you already implemented a SyncReplyObserver or are you using the MAM Observer?
If that is the case, Observers get registered only if you click on the Application link once before you do a sync. If you login and press on sync immediately the observers would not be registered.</i>
How can I register my observer regardless if I started my apllication or not.
I already tried it with <b><load-on-startup>1</load-on-startup></b> for my start servlet and register the observers there but that's not working.
What can I do next?
Thanks in advance,
Patrick Willems
hello patrick,
depending on how you implement your observers, there are
two ways to do this.
1) implement the Serializable interface
when your observer implements the Serializable interface
and you register it only once your application is once
invoked, the MI framework will try to serialize it. now,
when the MI is restarted and synched without activating
your application, the framework will try to deserialize
your observer and notify it. however, when the framework
encounters some problems when it tries to persist the
observer, it will ignore it and serialization fails.
2) implement a <a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/me/com/sap/ip/me/api/sync/SyncEventListener.html">SyncEventListener</a> or <a href="https://media.sdn.sap.com/javadocs/NW04/SPS15/me/com/sap/ip/me/api/smartsync/MessageReplyObserver.html">MessageReplyObserver</a>
when you implement a SyncEventListener and register it to
SyncEventRegistry, your listener will be notified with the
sync event like sync started or sync ready. however, if
the smartsync framework is notified prior to your app, it
will be too late to prepare if your app is smartsync. for
smartsync app, i would suggest to use the MessageReplyObserver.
the smartsync framework notifies every smartsync app when
the Sync starts and ends. the message reply type are
SYNC_BEGIN and SYNC_END. you can observe for both or only
one of them. register your MessageReplyObserver thru api
SmartSyncRuntime.getInboxNotifier().registerMessageReplyObserver(listener)
again, MI will try to serialize observers that implement
the Serializable interface. if serialization fails, MI
ignores it...
hope this helps.
jo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello jo,
Process flow:
1. Start MI framework and login.
2. Start application. In application I register the MessageReplyObeserver which implements the java.io.Serializable interface and the SyncEventListener which implements also the java.io.Serializable interface.
3. Exit application
4. Exit MI framwork
5. Start MI framework and login.
6. Push the sync button.
After step 6 I NEVER receive the SYNC_BEGIN and SYNC_END messages for the MessageReplyObserver.
After step 6 I DO receive SYNC_START, etc if I use the SyncEventListener.
How can I make my application to receive the SYNC_BEGIN and SYNC_END messages for the MessageReplyObserver without starting the application. (Only enter the application the first time to register the MessageReplyObserver).
Regards,
Patrick Willems
hello patrick,
looking at the decompiled code, seems that the serialization
of observers was removed... i don't know when. might have
been removed due to performance reasons. i don't have the
latest version... try checking inside the sync directory
for serialized observers.
automatically startup your application using the
startup.properties functionality. i haven't tried it
though. the load-on-startup settings for tomcat might be
usable, but MI should be loaded prior to your application.
you might have to assign a lowest number for MI's load-on
-startup settings if not assigned.
your last option is to use the SyncEventListener of the
generic sync layer. however, im not sure if there's an
order for notification. your listener must be notified
before smartsync... might work a try...
regards
jo
Hello Jo,
Can you give me more information on the ssubjects you give me.
<i>try checking inside the sync directory
for serialized observers</i>
I looked in this directory but find nothing for observers. What am I looking for?
<i>automatically startup your application using the
startup.properties functionality</i>
I can't find any documentation about it. How can I use it?
<i>the load-on-startup settings for tomcat might be
usable, but MI should be loaded prior to your application.
you might have to assign a lowest number for MI's load-on
-startup settings if not assigned</i>
I can use the load-on-startup option for my application, but what must I use for the MI to start up?
<i>your last option is to use the SyncEventListener of the generic sync layer</i>
I registered and use the SyncEventListener. The method action performed is called with one of the following parameter values: 0(Sync started), 1(Sync ready), 2(Sync successful), 3(Last inbound file received) and 10(User sync finished). If I use the following code snipped:
private transient SyncBoDeltaRequestFacade deltaFacade = null;
if (deltaFacade == null) {
deltaFacade = SmartSyncRuntime.getInstance().getSyncBoDeltaRequestFacade();
}
deltaFacade.getSyncBoDeltaRequest(desc) returns null?
I don't know why? Can you give me a hint?
Regards,
Patrick Willems
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.