cancel
Showing results for 
Search instead for 
Did you mean: 

Detect qRFC in JCo

koitka
Explorer
0 Kudos

Hi all,

I got a JCo Server implementation.

There is a Java function handler which is invoked from SAP. It might be invoked via direct RFC or via queued RFC.

Is it possible to detect in the Java world, if the current call is direct or queued?

Gruß,

Sebastian

koitka
Explorer
0 Kudos

Wow you are editing user questions? 😮

Accepted Solutions (1)

Accepted Solutions (1)

Ulrich_Schmidt
Product and Topic Expert
Product and Topic Expert

Yes, you can use the JCoServerContext object that is being passed into your handleRequest() implementation:

JCoServerCallType callType = serverContext.getCallType();
String queuename = null;

switch (callType){
	case JCoServerCallType.SYNCHRONOUS:
		System.out.println("It's a synchronous RFC");
		break;
	case JCoServerCallType.BACKGROUND_TASK:
		queuename = serverContext.getQueueName();
		if (queuename == null)
			System.out.println("It's a transactional RFC");
		else
			System.out.println("It's a queued RFC");
		break;
	case JCoServerCallType.BACKGROUND_UNIT:
		System.out.println("It's a background RFC");
		break;
}<br>

(Note that when you try to compile this code with JCo 3.1.7, it won't compile: the method getQueueName() does not yet exist... You have to be patient a little bit and wait for 3.1.8, then the above will compile... But if you comment out this line for now, you can at least detect, whether the call was a synchronous one ("direct", as you call it) or a tRFC/qRFC one, which is perhaps already enough for your usecase.)

koitka
Explorer
0 Kudos

Thank you so much, it looks very promising!

Debugged some requests and they showed the expected different CallTypes!

Answers (0)