acuminous / jinkies

For playing comical sounds when your CI build breaks
Apache License 2.0
3 stars 0 forks source link

error in running custom jobs #1

Closed gautampachnanda closed 11 years ago

gautampachnanda commented 12 years ago

Hi,

I am trying to setup a custom job at a fixed time. But I am getting a error (see below).

My setup is on a mac with Java 6.

The job config is.

grails.plugin.quartz2.jobSetup.projectXStandup = { quartzScheduler, ctx ->

def job2 = ClosureJob.createJob('ProjectXStandup', { jobCtx , appCtx->
    try {
        Map params = [sourceId: 'project/x', theme: 'Scooby Doo', event: 'Stand-Up', channel: ['audio']]
        new HttpClientsFactory().getHttpBuilder('http://localhost:8080/api/event').post(body: params)
    } catch (Throwable t) {
        Logger.getLogger('ProjectXStandupJob').error('An error while sounding the Project X standup', t)
    }
})

def trigger2 = new CronTriggerImpl(
    name: 'ProjectX Stand-up Trigger',
    cronExpression: '0 40 21 ? * MON-FRI' // 09:30 Monday - Friday
)

quartzScheduler.scheduleJob(job2, trigger2)

}

let me know if you need any info.

An error while sounding the Project X standup groovy.lang.MissingMethodException: No signature of method: uk.co.acuminous.jinkies.util.HttpClientsFactory.getHttpBuilder() is applicable for argument types: (java.lang.String) values: [http://localhost:8080/api/event] Possible solutions: getHttpBuilder() at

Thanks

cressie176 commented 12 years ago

Sorry I've taking so long to repsond. I didn't notice the issue and for some reasons didn't receive a github notification.

Can you confirm you have the following import statements...

import org.apache.log4j.Logger import org.quartz.impl.triggers.CronTriggerImpl import grails.plugin.quartz2.ClosureJob import uk.co.acuminous.jinkies.util.HttpClientsFactory

I'm afraid I can't look at this today, but I'll add in your config tomorrow and see whether I get the same error

cressie176 commented 11 years ago

OK. My bad.

    new HttpClientsFactory().getHttpBuilder('http://localhost:8080/api/event').post(body: params)

should be

    new HttpClientsFactory().getHttpBuilder().post(uri: http://localhost:8080/api/event', body: params)