Thursday 16 January 2014

Outage on CfmlNotifier

G'day:
I actually meant to post this when it actually happened: yesterday or the day before yesterday whenever it was. It's been a busy week. Anyway, there was an outage on the CfmlNotifier feed. It's now resolve.

A day or so ago Twitter changed their rules regarding using their API: they changed to only allowing HTTPS requests. I dunno if they actually forewarned about this or not (they probably did), but it caught me unawares, and also at an inconvenient time to sort it out.

That said, it didn't take much remedial action. I use Twitter4J as my proxy to Twitter's API, and all I needed to do was to pass an extra argument to its config to switch on SSL, and give it a new URL:

component {

    variables.messageSize = 140;
    variables.restBaseURL = "https://api.twitter.com/1.1/";

    public TwitterService function init(required string consumerKey, required string consumerSecret, required string accessToken, required string accessTokenSecret){
        var javaLoader = createObject("javaloader.JavaLoader").init([expandPath("/twitter4j/twitter4j-core-3.0.3.jar")]);
        var configBuilder = javaLoader.create("twitter4j.conf.ConfigurationBuilder");

        configBuilder.setUseSSL(javacast("boolean", true));
        configBuilder.setRestBaseURL(variables.restBaseURL);
        configBuilder.setOAuthConsumerKey(arguments.consumerKey);
        configBuilder.setOAuthConsumerSecret(arguments.consumerSecret);
        configBuilder.setOAuthAccessToken(arguments.accessToken);
        configBuilder.setOAuthAccessTokenSecret(arguments.accessTokenSecret);
        variables.twitter = javaLoader.create("twitter4j.TwitterFactory").init(configBuilder.build()).getInstance();

        return this;
    }

It sucked to have to use javaCast() on a literal true keyword (CF seemed to pass it as a string, otherwise), but so be it: it's no surprise really is it.

After doing that, I was still getting an error:

sun.security.validator.ValidatorException
unable to find valid certification path to requested target


But that was just a matter of getting Russ @ CFMLDeveloper to install the SSL certs on the ColdFusion server, and I was away laughing again. Cheers Russ.

So if you subscribe to the CfmlNotifier feed, you will have just been slapped with a few days' traffic all at once. Which amounts to... [counts]... 11 status updates. Breezing through them, there's not been much going on recently.

Anyway, sorry about the break in continuity there.

Righto.

--
Adam