如何使用Putty在一个命令中解压缩所有tar文件。
我尝试了以下内容,但并没有解除限制(所有文件均以alcatelS *开头)
tar -xfv alcatelS*.tar
Run Code Online (Sandbox Code Playgroud)
它不起作用,我没有收到任何错误,并且它也不会失去作用。谢谢,
我有一个shell脚本代码,可以在6个服务器中的任何一个上运行,一个文件得到更新.但是我需要维护一个公共文件来获取文件中最新的更改并在最新文件上应用某些逻辑.那么,我想知道当前服务器名称在特定时刻运行的位置?
这是我的代码,我已经修复了一个abc.com服务器我的公共服务器,我保存文件,下次我从中检索文件.但我还需要当前的服务器名称,因为某些操作需要基于当前服务器完成.所以,我只想添加一行代码,它让我回到运行它的当前服务器.
#!/bin/bash
# This code copies the file with latest changes to a common location.
server_name=abc.com
# backlog.txt is my file name
echo - removing the old files , if any
rm $server_name:/home/backlog.txt
echo "$server_name to copy the file"
scp /location/backlog.txt $server_name:/home/
echo "Copy complete."
exit 0
Run Code Online (Sandbox Code Playgroud)
还有这个:
#!/bin/bash
# This code copies back the common file from common server location "abc" and then make the changes into it. As I always need to work on the latest file. …Run Code Online (Sandbox Code Playgroud) 我有兴趣在 Camel 中使用 RedeliveryPolicy 在返回特定异常时重试将消息重新传递到端点。但我似乎找不到很多如何配置它的示例。
目前我正在尝试:
from("direct:entry")
.onException(ResourceNotFoundException.class)
.redeliveryPolicy(new RedeliveryPolicy().delayPattern("delayPattern=0:" + aocmDelay + ",10:1000;15:2000:19:10000"))
.handled(true)
.end()
.to("direct:destination");
Run Code Online (Sandbox Code Playgroud)
我的目标端点因 ResourceNotFoundException 失败,但未调用 onException 处理,并且重新传递未生效。对我做错了什么有什么想法吗?
我们在Camel中定义了一个路由,并且如果在处理器中抛出异常,则必须找出它.当我们只有一个处理器时,Camel会在sendBody()方法中重新抛出异常.如果存在先前的分割/聚合,则不会抛出异常.所以下面例子的结果是
before throwing Exception
after sendBody
Run Code Online (Sandbox Code Playgroud)
如果我省略从.split到.completionSize(1)的所有内容,则输出为
before throwing Exception
Exception thrown
Run Code Online (Sandbox Code Playgroud)
任何想法如何找出,如果分裂后发生异常?
private static final String DIRECT_START = "direct:start";
public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from(DIRECT_START)
.split(body())
.aggregate(constant(true), new AggregationStrategy() {
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
return oldExchange == null ? newExchange : oldExchange;
}
})
.completionSize(1)
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
System.out.println("before throwing Exception"); …Run Code Online (Sandbox Code Playgroud) 我在从骆驼中的 bean 获取返回值并在我的路线中使用它时遇到了一些麻烦。
我有一条看起来像这样的路线:
from(file:test/?delete=true)
.unmarshal(jaxb)
.bean(testBean, "testMethod")
.to(direct:nextRoute);
Run Code Online (Sandbox Code Playgroud)
该豆看起来像这样:
public void testBean (PojoName pojoInstance){
//do stuff
int i= 75; //a number I generate within the bean after I've started this method
}
Run Code Online (Sandbox Code Playgroud)
我想使用我在 bean 内部和路线中生成的数字。像这样的东西:
from(file:test/?delete=true)
.unmarshal(jaxb)
.bean(testBean, "testMethod")
.log(integer generated from testBean)
.to(direct:nextRoute);
Run Code Online (Sandbox Code Playgroud)
我尝试过的:
因此,我没有在 bean 中返回 void,而是将返回类型更改为 int 并返回整数。然后,我希望在我的路线中做这样的事情:
.log("${body.intFromBean}")
Run Code Online (Sandbox Code Playgroud)
我的想法是,一旦我从 bean 返回值,它应该将该值存储在交换体中(至少这是我从 Camel 文档中得到的)。然后,我可以在我的路线中访问它。
问题:
但是,当我将 testBean 返回类型更改为 int 时,出现以下错误:
org.apache.camel.CamelExecutionException: Execution occurred during execution on the exchange
Caused by: org.apache.camel.InvalidPayloadException: No body available of type: …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的流程方法中设置一些属性,但我无法弄清楚如何在xml中使用这些属性,就像我可以使用语法轻松地在xml中使用标头值:$ {in.header.myKey }
这是我的代码:
<route>
<from uri="activemq:queue:start.queue" />
<to uri="stream:out" />
<process ref="jsonProcessor"></process>
<to uri="bean:validateInputIdentifiers?method=validation(${in.property.SourceMap}, ${in.property.DestinationMap})" />
</route>
Run Code Online (Sandbox Code Playgroud)
这里in.property.SourceMap是Unknown函数.什么是正确的方法?如果它类似于标题会很棒.此外,我想只使用属性而不是标题,因为标题的值可能不会在我的路由中保留.
这是流程方法代码:
@Override
public void process(Exchange exchange) throws Exception {
List<Map<String, String>> body = exchange.getIn().getBody(List.class);
Map<String, String> sourceMap = body.get(0);
Map<String, String> destinationMap = body.get(1);
exchange.setProperty("SourceMap", sourceMap);
exchange.setProperty("DestinationMap", destinationMap);
}
Run Code Online (Sandbox Code Playgroud)
请提供解决方案.
有时,当我调试路由时,在交换中看到异常,其他时候异常转到CamelExceptionCaught属性。它们之间有什么区别?
我在交换对象的标题中设置一个List与其他几个标题并将其路由到ActiveMQ.
exchange.getOut().setHeader("testList", testList);
exchange.getOut().setHeader("testObject", testObject);
exchange.getOut().setHeader("header1", "value1");
exchange.getOut().setHeader("header2", "value2");
Run Code Online (Sandbox Code Playgroud)
在我访问交换对象的标题时的下一个路径中,"testList"并且testObject不存在!但剩下的标题存在(exchange.getIn().getHeader).
我们不能发送除String之外的任何标题(列表或任何其他对象)吗?
嗨,我想使用我的骆驼交换中的标头值作为我的 JsonPath 表达式中的过滤条件。
有这样的想法:
.setBody().jsonpath("$.person[?(@.role=='${headers.role}')]")
Run Code Online (Sandbox Code Playgroud)
简单的表达式不会以这种方式解析。
如何使用 Apache Camel 完成此操作?