Верблюд не может создать маршрут из-за отсутствия свойств конечной точки olingo - PullRequest
0 голосов
/ 21 ноября 2018

Я пытаюсь настроить очень простой маршрут для тестирования компонента camel-olingo2.Во время запуска я могу убедиться, что мой Olingo2Component заполнен правильным serviceUri, а также добавлен в camelContext.В настоящее время я тестирую на общедоступном сайте тестирования OData и могу убедиться, что данные там есть

Вот как компонент Olingo добавляется к верблюду

@Bean
public Olingo2Component olingo2Component() {

    Olingo2Configuration olingo2Configuration = new Olingo2Configuration();
    olingo2Configuration.setServiceUri("https://services.odata.org/TripPinRESTierService");

    Olingo2Component olingo2Component = new Olingo2Component();
    olingo2Component.setConfiguration(olingo2Configuration);

    CamelContext camelContext = new DefaultCamelContext();
    camelContext.addComponent("olingo2", olingo2Component);

    return olingo2Component;
}

Мой маршрут выглядит следующим образом

<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="test" autoStartup="true">
        <from uri="olingo2Component://read/People"/>
        <log message="${body}" />
    </route>
</routes>

Я не понимаю, какие свойства действительно отсутствуют.Я ожидаю получить json с записями OData о People, поскольку я не добавил запрос

. Любая помощь или советы будут высоко оценены

Полная трассировка стека ниже

2018-11-21 11:01:46,123 o.s.b.SpringApplication ERROR - Application run failed(858)
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route test: Route(test)[[From[olingo2Component://read/People]] -> [Log[$... because of Missing properties for /read, need one or more from [endpointHttpHeaders, responseHandler, queryParams, edm]
	at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1830)
	at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136)
	at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:174)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:398)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:355)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:882)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
	at se.tradechannel.suitability.SuitabilityApplication.main(SuitabilityApplication.java:15)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route test: Route(test)[[From[olingo2Component://read/People]] -> [Log[$... because of Missing properties for /read, need one or more from [endpointHttpHeaders, responseHandler, queryParams, edm]
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:147)
	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3949)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3856)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3642)
	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3494)
	at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3253)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249)
	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3272)
	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3249)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3165)
	at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)
	... 14 common frames omitted
Caused by: java.lang.IllegalArgumentException: Missing properties for /read, need one or more from [endpointHttpHeaders, responseHandler, queryParams, edm]
	at org.apache.camel.util.component.ApiConsumerHelper.findMethod(ApiConsumerHelper.java:61)
	at org.apache.camel.util.component.AbstractApiConsumer.<init>(AbstractApiConsumer.java:52)
	at org.apache.camel.component.olingo2.Olingo2Consumer.<init>(Olingo2Consumer.java:37)
	at org.apache.camel.component.olingo2.Olingo2Endpoint.createConsumer(Olingo2Endpoint.java:92)
	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:69)
	at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:107)
	at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:172)
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145)
	... 26 common frames omitted
2018-11-21 11:01:46,128 s.t.s.SuitabilityApplication ERROR - org.apache.camel.FailedToCreateRouteException: Failed to create route test: Route(test)[[From[olingo2Component://read/People]] -> [Log[$... because of Missing properties for /read, need one or more from [endpointHttpHeaders, responseHandler, queryParams, edm](19)
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route test: Route(test)[[From[olingo2Component://read/People]] -> [Log[$... because of Missing properties for /read, need one or more from [endpointHttpHeaders, responseHandler, queryParams, edm]
	at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1830)
	at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136)
	at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:174)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:398)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:355)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:882)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
	at se.tradechannel.suitability.SuitabilityApplication.main(SuitabilityApplication.java:15)
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route test: Route(test)[[From[olingo2Component://read/People]] -> [Log[$... because of Missing properties for /read, need one or more from [endpointHttpHeaders, responseHandler, queryParams, edm]
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:147)
	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3949)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3856)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3642)
	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3494)
	at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3253)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249)
	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3272)
	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3249)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3165)
	at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133)
	... 14 common frames omitted
Caused by: java.lang.IllegalArgumentException: Missing properties for /read, need one or more from [endpointHttpHeaders, responseHandler, queryParams, edm]
	at org.apache.camel.util.component.ApiConsumerHelper.findMethod(ApiConsumerHelper.java:61)
	at org.apache.camel.util.component.AbstractApiConsumer.<init>(AbstractApiConsumer.java:52)
	at org.apache.camel.component.olingo2.Olingo2Consumer.<init>(Olingo2Consumer.java:37)
	at org.apache.camel.component.olingo2.Olingo2Endpoint.createConsumer(Olingo2Endpoint.java:92)
	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:69)
	at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:107)
	at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:172)
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145)
	... 26 common frames omitted

1 Ответ

0 голосов
/ 25 ноября 2018

Я заметил, что свойство edm (модель данных объекта) должно добавляться автоматически.Верблюд-олинго делает начальный вызов с $ metadata, чтобы найти get edm.Другие свойства также должны быть добавлены автоматически.Это не работает, если у вас есть начальная конечная точка как olingo.Хотя в документах говорится, что это так.

Вы можете попробовать

<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="test" autoStartup="true">
        <from uri="timer://olingo.test?repeatCount=1&delay=-1"/>
        <to uri="olingo2Component://read/People"/>
        <log message="${body}" />
    </route>
</routes>

, что даст вам исключение "Внутренняя ошибка сервера", поскольку https://services.odata.org/TripPinRESTierService использует odata v4.

Перейдите на компонент camel-olingo4, чтобы он возвращал данные.

...