小编FVl*_*lad的帖子

Google Chrome扩展程序中的同步通话

我正在使用Google Chrome扩展程序,该扩展程序必须阻止/重定向某些传出请求.为此,我使用了chrome.webRequest.onBeforeRequest监听器.要决定是否阻止请求,我需要一些有关选项卡请求的信息.我可以使用它chrome.tabs.get(integer tabId, function callback),但回调是异步的,这意味着它可以在从onBeforeRequest侦听器返回值后调用.

chrome.webRequest.onBeforeRequest.addListener(function(details){
 chrome.tabs.get(details.tabId, function(tab){
  // get info from tab
 }); 
 // based on info from tab return redirect or not
}), {
 urls: ["<all_urls>"],
 types: ["main_frame"]
}, ["blocking"]);
Run Code Online (Sandbox Code Playgroud)

有没有办法同步通话?或许还有一些其他选择.

javascript google-chrome synchronize

9
推荐指数
1
解决办法
2579
查看次数

动态更新Eureka实例元数据

当Spring Cloud Eureka实例启动时,我可以静态地(eureka.instance.metadataMap.*在我的application.yml)中或动态地(EurekaInstanceConfigBean例如使用)定义一些实例元数据.但是一旦注册了实例,在更新配置bean之后,这个元数据就不再在Eureka中更新了.有没有办法定义一些将在Eureka中动态更新的元数据?因此,Eureka的工作方式类似于每个实例的键值存储.

spring-cloud netflix-eureka spring-cloud-netflix

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

Spring Cloud Stream 不创建队列

我正在尝试使用 RabbitMQ 配置一个简单的 Spring Cloud Stream 应用程序。我使用的代码主要来自spring-cloud-stream-samples。我有一个切入点:

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

以及示例中的简单消息生产者:

@EnableBinding(Source.class)
public class SourceModuleDefinition {

    private String format = "yyyy-MM-dd HH:mm:ss";

    @Bean
    @InboundChannelAdapter(value = Source.OUTPUT, poller = @Poller(fixedDelay = "${fixedDelay}", maxMessagesPerPoll = "1"))
    public MessageSource<String> timerMessageSource() {
        return () -> new GenericMessage<>(new SimpleDateFormat(this.format).format(new Date()));
    }

}
Run Code Online (Sandbox Code Playgroud)

此外,这里是 application.yml 配置:

fixedDelay: 5000
spring:
  cloud:
    stream:
      bindings:
        output:
          destination: test
Run Code Online (Sandbox Code Playgroud)

当我运行该示例时,它连接到 Rabbit 并创建一个名为 test 的交换。但我的问题是,它不会自动创建队列和绑定。我可以看到 Rabbit 中的流量,但是我所有的消息都消失了。虽然我需要它们留在某个队列中,除非消费者读取它们。 …

spring spring-cloud-stream

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