[OFBiz] Users - How does one keep a sync'd service fromrescheduling?

Mike Baschky mbaschky at go-integral.com
Wed Aug 25 14:41:48 EDT 2004


Hi Again,
	Ok this issue is solved if you have the services run in different transactions. If they run in the same transaction and service A fails then the whole thing fails and ofbiz reschedules the originating service (B). So there are two ways to solve this. One, in the service.xml use the require-new-transaction="true" attribute in the service definiton. Two, tell service A to run in a sperate transaction by using "dispatcher.runSync( String servicename,  Map context, int transactiontimeout, boolean requireNewTransaction)" method signature. Either one appears to work.

Mike

-----Original Message-----
From: Mike Baschky 
Sent: Tuesday, August 24, 2004 4:41 PM
To: users at lists.ofbiz.org
Subject: [OFBiz] Users - How does one keep a sync'd service
fromrescheduling?


Hi,
	I'll try and keep this from getting to convoluted - what I want to do is kick off a sync'd service(A) inside another service (B) and if service A fails I want to handle the issue in service B (i.e., I don't want ofbiz to reschedule anything). However what I'm finding is that when I kick of service B which in turn kicks off service A (sync'd) and service A fails ofbiz reschedules Service B??? As a trival example:

           SERVICE A:
	public static Map retrieveGO50RankReport( DispatchContext dctx, Map context ) {
		Map resultMap = new HashMap();
		((Map) resultMap).put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);
		
		return resultMap;
	}

       

	SERVICE B:
	
	public static Map failGO50RankReport( DispatchContext dctx, Map context ) {
		Map rresultMap = new HashMap();
		LocalDispatcher dispatcher = dctx.getDispatcher();
       	try {

        		rresultMap = dispatcher.runSync("retrieveGO50RankReport", context);
		Debug.logInfo("INSIDE THE MAP: "+ rresultMap.toString(), module);
        	} catch (GenericServiceException e) {
            	//DO nothing

           }		
		return ServiceUtil.returnSuccess();;

	}

When I kick off service B via webtools and A fails I get B being rescheduled and an error about 'commit transactions failing with a null value.' Looking through the API I don't find a way of telling sync'd services not to persist. I do find such abilities in in runAsyncWait (dispatcher.runAsyncWait("retrieveGO50RankReport", context, false)) and in runAsync dispatcher.runAsync("retrieveGO50RankReport", context, false ). As I said I'm kicking B off in webtools (job scheduling) for testing purposes so is my issue maybe with webtools scheduling or am I missing something more basic with Services. Thanks.

Mike
 
_______________________________________________
Users mailing list
Users at lists.ofbiz.org
http://lists.ofbiz.org/mailman/listinfo/users


More information about the Users mailing list