org.springframework.util.JdkIdGenerator Java Examples

The following examples show how to use org.springframework.util.JdkIdGenerator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PresentController.java    From brewery with Apache License 2.0 6 votes vote down vote up
@RequestMapping(
		value = "/order",
		method = POST)
String order(HttpEntity<String> body) {
	String processIdFromHeaders = body.getHeaders().getFirst(PROCESS_ID_HEADER_NAME);
	String processId = StringUtils.hasText(body.getHeaders().getFirst(PROCESS_ID_HEADER_NAME)) ?
			processIdFromHeaders :
			new JdkIdGenerator().generateId().toString();
	log.info("Making new order with [{}] and processid [{}].", body.getBody(), processId);
	Span span = this.tracer.nextSpan().name("inside_presenting").start();
	Tracer.SpanInScope ws = tracer.withSpanInScope(span);
	try {
		String testCommunicationType = BaggageField.getByName("TEST-COMMUNICATION-TYPE").getValue();
		log.info("Found the following communication type [{}]", testCommunicationType);
		switch (testCommunicationType) {
		case "FEIGN":
			return useFeignToCallAggregation(body, processId);
		default:
			return useRestTemplateToCallAggregation(body, processId);
		}
	} finally {
		span.finish();
		ws.close();
	}
}