小编Den*_*tti的帖子

无需提取即可预览 .7z 内容和子文件夹

我想预览 .7z 的内容而不用 Java 提取它,所以我尝试使用 Apache Commons Compress:

public static void main(String[] args) {
    try {
        SevenZFile sevenZFile = new SevenZFile(new File("C://test.7z"));
        SevenZArchiveEntry entry;
        while ((entry = sevenZFile.getNextEntry()) != null) {
            System.out.println("Name: " + entry.getName());
            System.out.println("Size : " + entry.getSize());
            System.out.println("--------------------------------");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

它可以工作,但我还想将文件预览到其他 7z 或原始 7z 的 zip 文件中:

test.7z
--- file1.txt
--- otherInner.7z
    ---- innerFile1.txt
    ---- innerFile2.txt
Run Code Online (Sandbox Code Playgroud)

有没有办法在不提取 7z 的情况下做到这一点?谢谢你的帮助。

java 7zip apache-commons-compress

5
推荐指数
1
解决办法
1300
查看次数

最大尝试后,在队列尾部重新排队兔子AMQP消息

我目前正在使用带弹簧的RabbitMQ(spring-rabbit-1.2.0-RELEASE),配置如下:

<rabbit:template id="amqpTemplate" connection-factory="connectionFactory"/>
<!-- Asynchronous exchanges -->
<!-- Admin -->
<rabbit:admin connection-factory="connectionFactory"/>

<!-- Error Handler -->
<bean id="biErrorHandler" class="my.project.sync.BiErrorHandler" />
<!-- Message converter -->
<bean id="biMessageConverter" class="my.project.sync.BiMessageConverter"/>

<bean id="retryInterceptor" class="org.springframework.amqp.rabbit.config.StatefulRetryOperationsInterceptorFactoryBean">
    <property name="messageRecoverer" ref="rejectAndDontRequeueRecoverer"/>
    <property name="retryOperations" ref="retryTemplate" />
    <property name="messageKeyGenerator" ref="biKeyGenerator" />
</bean> 

<bean id="biKeyGenerator" class="my.project.sync.BiMessageKeyGenerator"/>
<bean id="rejectAndDontRequeueRecoverer" class="org.springframework.amqp.rabbit.retry.RejectAndDontRequeueRecoverer"/>

<bean id="retryTemplate" class="org.springframework.retry.support.RetryTemplate">
    <property name="backOffPolicy">
        <bean class="org.springframework.retry.backoff.ExponentialBackOffPolicy">
            <property name="initialInterval" value="3000" />
            <property name="maxInterval" value="30000" />
        </bean>     
    </property>
    <property name="retryPolicy">
        <bean class="org.springframework.retry.policy.SimpleRetryPolicy">
            <property name="maxAttempts" value="3" />
        </bean>     
    </property>
</bean>  

 <rabbit:queue id="biSynchronizationQueue" name="BI_SYNCHRONIZATION_QUEUE" …
Run Code Online (Sandbox Code Playgroud)

spring amqp rabbitmq spring-rabbit spring-amqp

4
推荐指数
1
解决办法
5166
查看次数