Announcement Announcement Module
Collapse
No announcement yet.
Scheduling Conflicts, Ghost Messages, and Scalability issues Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scheduling Conflicts, Ghost Messages, and Scalability issues

    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:
    Code:
    		Connection<Facebook> connection = connectionRepository.findPrimaryConnectionToApi(Facebook.class);
    On the other hand, to retrieve a connection for the scheduler, I do the following:
    Code:
    connectionRepository = usersConnectionRepository.createConnectionRepository(providerUserId);
    				Connection<Facebook> connection = (Connection<Facebook>)  connectionRepository.findConnectionsToProvider("facebook").get(0);
    				return connection;
    In my applicationContext, I have the following bean declaration (I'm not using @Inject):
    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>
    My question here since both Connection objects are injected with the same bean, is it possible that the following line:
    Code:
    connectionRepository = usersConnectionRepository.createConnectionRepository(providerUserId);
    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.

    And here's another odd observation, if I use the following connection:
    Code:
    		Connection<Facebook> connection = connectionRepository.findPrimaryConnectionToApi(Facebook.class);
    to post on my wall via a JSP page, it gets posted on my Facebook feed and on my wall (the expected behavior)

    However, when I use the following connection:
    Code:
    connectionRepository = usersConnectionRepository.createConnectionRepository(providerUserId);
    				Connection<Facebook> connection = (Connection<Facebook>)  connectionRepository.findConnectionsToProvider("facebook").get(0);
    				return connection;
    to post on my wall via the scheduler, it gets posted only on my wall. It doesn't get posted on the feed.

    In both cases, the messages are published via:
    Code:
    getFacebookApi().publish("me", "feed", contentService.getFacebookMessage());
    where contentService.getFacebookMessage() is a MultiValueMap;


    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>
Working...
X