我有一个预先存在的Web服务"connect"(SOAP)我想在不使用Swing框架的情况下调用它.我已经使用cxf/wsdl2java工具跟踪了联系第一个开发生成我的java文件.
我希望从java对象中提取userName和密码,并将其放在SOAP对象中,然后发送到我的localhost Web服务上.
将Connect对象作为正文发送到"direct:start"时,我得到一个异常......
Caused by: java.lang.IllegalArgumentException: Get the wrong parameter size to invoke the out service, Expect size 2, Parameter size 1. Please check if the message body matches the CXFEndpoint POJO Dataformat request.
Run Code Online (Sandbox Code Playgroud)
我已经检查过第一个参数实际上是传入的Connect对象的一个实例.
我是否需要在其中一个类中添加一些额外的注释,测试方法是无效的还是
我应该遵循的替代模式?
public class TestConnectCXF extends CamelTestSupport
{
@Override
protected RouteBuilder createRouteBuilder() throws Exception
{
return new RouteBuilder()
{
String cxfAddressLine = "cxf:http://localhost:8081/nuxeo/webservices/privateadservice?wsdlURL=wsdl/privateadservice.wsdl" //
+ "&dataFormat=POJO" //
+ "&serviceClass=com.sandbox.camelfeed.PrivateAdServiceInterface" //
+ "&serviceName={http://ws.sandboxtest.com/}PrivateAdService" //
+ "&synchronous=true" //
+ "&loggingFeatureEnabled=true" //
+ "&portName={http://ws.sandboxtest.com/}PrivateAdServiceInterfacePort";
@Override
public void …Run Code Online (Sandbox Code Playgroud) 我是ESB的新手,并试图了解ESB概念和实际用例.
我挖掘了一些开源ESB产品,看起来Apache Camel是最着名的一个[来自Apache家族].
我发现,大多数人使用在Apache Camel上开发的Jboss Fuse,或者只是在Camel上添加了更多功能.
虽然,我正在尝试和搜索互联网将近半天,并且无法找到我们何时使用ESB和现实世界的示例场景和基本教程来启动和理解Fuse ESB.
任何人都可以指出我如何克服这个问题并在路线图上找到正确的方向,我也需要将它们与Liferay门户集成.
谁能告诉我end()和endChoice()骆驼之间的区别?我们可以end()代替使用endChoice()吗?
我正在尝试从Camel中的路由中删除一些样板.
例如,让我们考虑两条相似的路线,并且可以生成大部分内部东西.我创建了一个组件"模板",它创建TemplateEndpoint并修改了XML配置以使用模板组件.
TemplateEndpoint.generateRoute从StartupListener(定义中TemplateEndpoint.setSuffix)调用自定义方法(添加路由定义).因此,当Camel上下文启动时,路由定义出现在上下文中,但框架不会为它们创建路由服务,因此它们不会启动.
如何开始添加路线StartupListener?
可能我正面临一个XY问题,你可以建议我一个更好的方法来做这个技巧(即动态添加和启动路线).
类似的两条路线
<route id="route_A">
<from uri="restlet:/another1?restletMethods=GET" />
<to uri="first:run_A" />
<to uri="second:jump_A" />
<to uri="third:fly_A" />
</route>
<route id="route_B">
<from uri="restlet:/another2?restletMethods=GET" />
<to uri="first:run_B" />
<to uri="second:jump_B" />
<to uri="third:fly_B" />
</route>
Run Code Online (Sandbox Code Playgroud)
修改过的XML
<route id="route_A">
<from uri="restlet:/another1?restletMethods=GET" />
<to uri="template://?suffix=A" />
</route>
<route id="route_B">
<from uri="restlet:/another2?restletMethods=GET" />
<to uri="template://?suffix=B" />
</route>
Run Code Online (Sandbox Code Playgroud)
端点
public class TemplateEndpoint extends DefaultEndpoint {
/* some methods omitted */
// this endpoint …Run Code Online (Sandbox Code Playgroud) 有一个以上的例子,我从一个以openshift原点运行的pod中看到了这个状态.在这种情况下,这是cdi camel示例的快速入门.我能够在本地成功构建和运行它(非openshift)但是当我尝试在我的本地openshift(使用mvn -Pf8-local-deploy)上部署时,我得到了这个特定示例的输出(为了相关性而剪断): -
[vagrant@vagrant camel]$ oc get pods
NAME READY STATUS RESTARTS AGE
cdi-camel-z4czs 0/1 CrashLoopBackOff 4 2m
日志尾巴如下: -
Error occurred during initialization of VM
Error opening zip file or JAR manifest missing : agents/jolokia.jar
agent library failed to init: instrument
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个问题吗?
给出了一个非常简单的Camel捆绑包,用于生成camel-archetype-blueprint,我希望添加一个通过属性而不是在属性中配置的数据源blueprint.xml.
我尝试以各种方式配置PropertiesComponent并访问propertyMySQL数据源的值中的属性,但似乎没有一个工作.记录消息时,可以访问属性.
如何使用属性文件中的参数值配置数据源?
我特别需要这个,为多个bundle使用相同的数据源配置,并区分生产/测试环境.我考虑过在构建过程中使用Maven编写属性,具体取决于目标环境.有关如何解决此数据源问题的其他最佳实践吗?
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
<property name="location" value="classpath:config.properties" />
</bean>
<bean id="dataSourceMySQL" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
<property name="url" value="jdbc:mysql://127.0.0.1/test_database" />
<!-- This causes an error, as it tries to connect with
`${mysqlUser}`@`localhost` without any evaluation -->
<property name="user" value="${mysqlUser}" />
<property name="password" value="${mysqlPassword}" />
</bean>
<service interface="javax.sql.DataSource" ref="dataSourceMySQL">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/mysqlDatasource" />
</service-properties>
</service>
<bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
<property name="dataSource" ref="dataSourceMySQL" />
</bean> …Run Code Online (Sandbox Code Playgroud) 我有一个用例:
我需要定期阅读和聚合来自kafka主题的消息,并发布到不同的主题.Localstorage不是一种选择.这就是我计划解决这个问题的方法,欢迎任何改进建议
要安排kafka消息的聚合和发布,请计划使用Aggregator EIP的completionInterval选项.这是代码.
@Autowired ObjectMapper objectMapper;
JacksonDataFormat jacksonDataFormat;
@PostConstruct
public void initialize(){
//objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
jacksonDataFormat = new JacksonDataFormat(objectMapper,EventMessage.class);
}
Run Code Online (Sandbox Code Playgroud)
和路线:
public void configure() throws Exception {
from("kafka:localhost:9092?topic=item-events" +
"&groupId=aggregator-group-id&autoCommitIntervalMs=25000&autoOffsetReset=earliest&consumersCount=1")
.routeId("kafkapoller")
.unmarshal(jacksonDataFormat)
.aggregate(body().method("getItemId"), new EventAggregationStrategy()).completionInterval(20000)
.marshal().json(JsonLibrary.Jackson)
.to("kafka:localhost:9092?topic=item-events-aggregated&serializerClass=org.apache.kafka.common.serialization.ByteArraySerializer");
}
Run Code Online (Sandbox Code Playgroud) 我有一个单一的Java应用程序,围绕@Service我的业务服务层的Spring bean 构建.通常,我的每个业务服务方法都有Spring Security注释(例如@PreAuthorize)来为该操作强制执行适当的授权规则.
在主Web应用程序流程中,这非常有效; 每个Web请求隐式地具有由会话cookie等处理的认证.
但是,当涉及到与其他"内部"系统的各种集成点时,我没有看到清晰的解决方案.
例如,我将从JMS队列中消耗方法,该队列已经在代理中定义了自己的身份验证和授权规则,因此我想隐含地"信任"我得到的消息.但是,就像现在的情况一样,一个简单的Camel路线如下:
WidgetService widgetService = lookup(WidgetService.class);
from("activemq:newWidget")
.unmarshall(...)
.bean(widgetService, "newWidget");
Run Code Online (Sandbox Code Playgroud)
最后扔了一个AuthenticationCredentialsNotFoundException.
这告诉我Camel正在正确地调用我的bean,并且从Spring应用了所有神奇的AOP.
对于其他类似的事情,我已经围绕系统的入口点(例如,围绕Quartz Job的execute方法)应用AOP建议,这注入了一个PreAuthenticatedAuthenticationToken,但我不确定这是否真的是最好的方法.
我是否应该继续在建议中包含这些"可信"入口点以添加身份验证上下文,或者我是否应该更改我的服务层以使某些业务方法的特殊形式不需要身份验证,并确保我明确记录他们不是用于网络@Controller方法等?
我必须为数组 B 的每个元素调用一个服务。但数组 A 在数组 A 内。所以我尝试在camel_Context.xml 中使用 split inside split,如下所示。一旦执行了所有内部分割数组值,我还需要聚合它们。
<split>
<jsonpath>$.Request.Fruits</jsonpath>
<split>
<jsonpath>$.request.Fruits[index].item</jsonpath>
<to someURI>
</split>
</split>
Run Code Online (Sandbox Code Playgroud)
我在内部分割中使用的索引应该表示外部分割的当前迭代。CamelSplitIndex 将为您提供内部拆分的迭代次数。我不确定如何在外部分割中使用任何显式计数器。请问还有其他方法可以实现我的目标吗?
我是 apache Camel 的新手,并通过 Java DSL 使一些路由正常工作。
现在我想知道是否有机会使用 JBoss Fuse 自动获得这些路线的可视化表示?
我的意思是不再手工绘制它,更多的是自动记录:-)
编辑:
由于否决似乎比答案更容易,我尝试稍微改一下我的问题。
我正在寻找一种可能性,对我定义的路线(Java)进行逆向工程,并从中获取带有盒子的图片。
Hawtoi,我之前尝试过的,给出了一个漂亮的结果,但也提供了很多我的文档不需要的其他东西。
因此我看了一下 JBoss Fuse。但在这里我只能绘制我的流程并将它们保存为blueprint.xml。JBoss Fuse 中无法从 Java 代码到 blueprint.xml 吗?我错过了什么吗?
apache-camel ×10
java ×5
jbossfuse ×2
apache-kafka ×1
apache-karaf ×1
blueprint ×1
boilerplate ×1
cdi ×1
cxf ×1
datasource ×1
esb ×1
fabric8 ×1
hawtio ×1
jms ×1
routes ×1
soap ×1
split ×1
templates ×1