小编Ken*_*ter的帖子

如何使用Putty解压当前目录中的所有tar文件

如何使用Putty在一个命令中解压缩所有tar文件。

我尝试了以下内容,但并没有解除限制(所有文件均以alcatelS *开头)

 tar -xfv alcatelS*.tar
Run Code Online (Sandbox Code Playgroud)

它不起作用,我没有收到任何错误,并且它也不会失去作用。谢谢,

bash tar

2
推荐指数
1
解决办法
7462
查看次数

如何使用shell脚本知道运行代码的当前服务器名称?

我有一个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)

unix bash shell hostname

2
推荐指数
1
解决办法
7930
查看次数

如何在Camel中延迟重试

我有兴趣在 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 处理,并且重新传递未生效。对我做错了什么有什么想法吗?

java routes apache-camel

2
推荐指数
1
解决办法
4494
查看次数

Camel拆分后,Exception不会升级

我们在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)

java split apache-camel

2
推荐指数
1
解决办法
3430
查看次数

从 Camel 中的 Bean 获取返回值 (Java)

我在从骆驼中的 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)

java variables apache-camel

2
推荐指数
1
解决办法
1万
查看次数

Camel - 在Spring DSL中使用属性

我正在尝试在我的流程方法中设置一些属性,但我无法弄清楚如何在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)

请提供解决方案.

spring apache-camel

2
推荐指数
1
解决办法
2269
查看次数

Apache Camel:exchange.getException()与CamelExceptionCaught属性

有时,当我调试路由时,在交换中看到异常,其他时候异常转到CamelExceptionCaught属性。它们之间有什么区别?

apache-camel

2
推荐指数
1
解决办法
2954
查看次数

Apache Camel - 在路由到ActiveMQ期间,除String外,所有标头都丢失了

我在交换对象的标题中设置一个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之外的任何标题(列表或任何其他对象)吗?

activemq-classic jms apache-camel

2
推荐指数
1
解决办法
1630
查看次数

我可以在 JsonPath 语言中使用 Camel 简单表达式吗?

嗨,我想使用我的骆驼交换中的标头值作为我的 JsonPath 表达式中的过滤条件。

有这样的想法:

.setBody().jsonpath("$.person[?(@.role=='${headers.role}')]")
Run Code Online (Sandbox Code Playgroud)

简单的表达式不会以这种方式解析。

如何使用 Apache Camel 完成此操作?

apache-camel jsonpath

2
推荐指数
1
解决办法
2916
查看次数

如何从多个文件中轮询最后修改的文件并发送到Apache骆驼中的目标端点?

在这里,我们有4个具有不同时间戳的文件。我们只需要选择最新的文件(使用Apache camel的时间戳为18/08/2016的第一个文件)。

演示

如何实现呢?我找不到有关此主题的太多资源。

java file last-modified apache-camel

2
推荐指数
1
解决办法
678
查看次数