My application is primary a scheduler where you can schedule messages posted on various Social Networks (for now Facebook and Twitter).
I have a couple of questions.:
1. Ghost Messages
I'm able to post Facebook messages on my account's wall via my application. My scheduler is also able to post the same messages, but after a couple of messages (maybe 20 scheduled messages), the 21st will not post. Whenever a message is sent, a corresponding response is given by Facebook. For some reason this message that will not post returns with a null id. The odd thing is this is the same message that I was able to post manually via my application and also as a scheduled message. To resolve the issue I switch to a different Facebook account, create a connection, and the message will get posted. But when I return to the original account, the message will not post still. It appears as if the permissions have expired? How so?
2. In my application you can log-in and connect your Facebook account and post messages. Behind the scenes the app is also a scheduler that polls the db every 5 seconds, which means other users that have scheduled messages will be posted. The currently-logged in user is in no way interrupted.
To retrieve a connection to the currently logged-in user, I do the following:
On the other hand, to retrieve a connection for the scheduler, I do the following:Code:Connection<Facebook> connection = connectionRepository.findPrimaryConnectionToApi(Facebook.class);
In my applicationContext, I have the following bean declaration (I'm not using @Inject):Code:connectionRepository = usersConnectionRepository.createConnectionRepository(providerUserId); Connection<Facebook> connection = (Connection<Facebook>) connectionRepository.findConnectionsToProvider("facebook").get(0); return connection;
My question here since both Connection objects are injected with the same bean, is it possible that the following line:Code:<bean id="connectionRepository" factory-method="createConnectionRepository" factory-bean="usersConnectionRepository" scope="request"> <constructor-arg value="#{request.userPrincipal.name}" /> <aop:scoped-proxy proxy-target-class="false"/> </bean>
can messed up the connection of the currently logged-in user? Based on my observation, it doesn't, but somehow I have feeling it should conflict. I need clarifications about this.Code:connectionRepository = usersConnectionRepository.createConnectionRepository(providerUserId);
And here's another odd observation, if I use the following connection:
to post on my wall via a JSP page, it gets posted on my Facebook feed and on my wall (the expected behavior)Code:Connection<Facebook> connection = connectionRepository.findPrimaryConnectionToApi(Facebook.class);
However, when I use the following connection:
to post on my wall via the scheduler, it gets posted only on my wall. It doesn't get posted on the feed.Code:connectionRepository = usersConnectionRepository.createConnectionRepository(providerUserId); Connection<Facebook> connection = (Connection<Facebook>) connectionRepository.findConnectionsToProvider("facebook").get(0); return connection;
In both cases, the messages are published via:
where contentService.getFacebookMessage() is a MultiValueMap;Code:getFacebookApi().publish("me", "feed", contentService.getFacebookMessage());
3. Let's assume I have 1000 users each having his own connection to Facebook. Everyone let's say have scheduled a message to be posted at 3:50am. My application would of course process the first user. But the problem is by the time it reaches the 1000th user, the time that has elapsed would be noticeable? Why? Because I tried for example, scheduling a message to be posted at 3:50:00am. Sometimes it gets posted at 3:50:01am. There's a 01 delay. And that's only for two users that have scheduled messages. Now, imagine having 1000 users. What's the best way to resolve this scenario or am I expecting too much from my application?
Additional info:
Maven properties section:
Code:<properties> <spring.version>3.1.0.M1</spring.version> <spring.social.version>1.0.0.BUILD-SNAPSHOT</spring.social.version> <spring.security.version>3.1.0.RC2</spring.security.version> </properties>


Reply With Quote