Results 1 to 1 of 1

Thread: Spring+Quartz+commonj+WorkManagerTaskExecutor+Webs phere

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Posts
    1

    Default Spring+Quartz+commonj+WorkManagerTaskExecutor+Webs phere

    Hi,
    I am using Spring+Quartz+commonj+WorkManagerTaskExecutor on Websphere to do some job scheduling.
    Problem: I would like to call a Jersey Resource by using Jersey Client API or HTTPClient inside the scheduler method at certain time intervals. My job bean gets triggered and a simple system.out works expected. But if i implement my logic (by using Jersey client) within that execute method, then that logic was never called or nothing happens.

    Web.xml
    Code:
    <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
               classpath:scheduler-config.xml
            </param-value>
        </context-param>
    scheduler-config.xml
    Code:
    <bean id="sampleJob" class="de.scheduler.ScheduleTimer" lazy-init="default" autowire="default" dependency-check="default" />
    
    <bean id="sampleJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean" lazy-init="default" autowire="default" dependency-check="default">
            <property name="targetObject">
                <ref bean="sampleJob" /> 
            </property>
            <property name="targetMethod">
                <value>executeJob</value> 
            </property>
            <property name="concurrent" value="false" />
        </bean>
        
        <bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean" lazy-init="default" autowire="default" dependency-check="default">
            <property name="jobDetail">
            <ref bean="sampleJobDetail" />
            </property>
            <!-- startDelay 100 seconds -->        
            <property name="startDelay" value="100000">         
            </property>
            
            <!-- repeat every 50 seconds -->
            <property name="repeatInterval" value="50000"/>
            
        </bean>
        
        <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
            <property name="triggers">
                <list>
                    <ref bean="simpleTrigger" />
                </list>
            </property>
            <property name="taskExecutor" ref="taskExecutor"></property>
        </bean>
     
        <bean id="taskExecutor" class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
            <property name="workManagerName" value="wm/default"/>
            <property name="resourceRef" value="false"/>
        </bean>
    
    </beans>
    ScheduleTimer.java
    Code:
    public class ScheduleTimer {
        public void executeJob() {
            System.out.println("Job started at: " + new Date());
    ClientConfig config = new DefaultClientConfig();
    Client client = Client.create(config);
    WebResource service = client.resource("http://localhost:10040/AppContext");
    
    // Get plain text
    		System.out.println(service.path("webresources").path("addsmsmessage").queryParams(params).accept(			MediaType.TEXT_PLAIN).post(String.class));
    Please help me.
    Last edited by prem11; Sep 21st, 2010 at 07:56 AM. Reason: typo

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •