当前位置: 首页 > news >正文

杭州做网站比较出名的公司有哪些企业品牌推广策划方案

杭州做网站比较出名的公司有哪些,企业品牌推广策划方案,上海货拉拉注册公司地址,做贸易要看什么网站发布/订阅是GCP提供的不错的工具。 它非常方便#xff0c;可以帮助您解决应用程序可能面临的消息传递难题。 实际上#xff0c;如果您使用GCP#xff0c;则可以使用托管消息解决方案。 如预期的那样#xff0c;使用实际的发布/订阅解决方案需要一定的配额#xff0c;因此… 发布/订阅是GCP提供的不错的工具。 它非常方便可以帮助您解决应用程序可能面临的消息传递难题。 实际上如果您使用GCP则可以使用托管消息解决方案。 如预期的那样使用实际的发布/订阅解决方案需要一定的配额因此对于 开发中必须使用不会花钱的东西。 在这些情况下您可以使用Pub / Sub 仿真器 。 要开始使用模拟器您需要先安装它 gcloud components install pubsub-emulator 确实很方便但是具有docker映像因为它更便于携带。 不幸的是没有来自Google Cloud的官方图片但是您可以使用Docker Hub上可用的解决方案之一。 现在运行它 gcloud beta emulators pubsub start --project test -project 之后您的应用程序可以连接到发布/订阅模拟器。 默认端口为8085 我将以Java单元测试为例。 package org.gkatzioura.pubsub; import java.io.IOException; import java.nio.charset.Charset; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import com.google.api.gax.core.CredentialsProvider; import com.google.api.gax.core.NoCredentialsProvider; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.rpc.FixedTransportChannelProvider; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.cloud.pubsub.v1.Publisher; import com.google.cloud.pubsub.v1.SubscriptionAdminClient; import com.google.cloud.pubsub.v1.SubscriptionAdminSettings; import com.google.cloud.pubsub.v1.TopicAdminClient; import com.google.cloud.pubsub.v1.TopicAdminSettings; import com.google.cloud.pubsub.v1.stub.GrpcSubscriberStub; import com.google.cloud.pubsub.v1.stub.SubscriberStub; import com.google.cloud.pubsub.v1.stub.SubscriberStubSettings; import com.google.protobuf.ByteString; import com.google.pubsub.v1.ProjectSubscriptionName; import com.google.pubsub.v1.ProjectTopicName; import com.google.pubsub.v1.PubsubMessage; import com.google.pubsub.v1.PullRequest; import com.google.pubsub.v1.PullResponse; import com.google.pubsub.v1.PushConfig; import com.google.pubsub.v1.Subscription; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; public class LocalPubSubTest { private static final String PROJECT test-project ; private static final String SUBSCRIPTION_NAME SUBSCRIBER ; private static final String TOPIC_NAME test-topic-id ; private static final String hostPort 127.0.0.1:8085 ; private ManagedChannel channel; private TransportChannelProvider channelProvider; private TopicAdminClient topicAdmin; private Publisher publisher; private SubscriberStub subscriberStub; private SubscriptionAdminClient subscriptionAdminClient; private ProjectTopicName topicName ProjectTopicName.of(PROJECT, TOPIC_NAME); private ProjectSubscriptionName subscriptionName ProjectSubscriptionName.of(PROJECT, SUBSCRIPTION_NAME); private Subscription subscription; Before public void setUp() throws Exception { channel ManagedChannelBuilder.forTarget(hostPort).usePlaintext().build(); channelProvider FixedTransportChannelProvider.create(GrpcTransportChannel.create(channel)); CredentialsProvider credentialsProvider NoCredentialsProvider.create(); topicAdmin createTopicAdmin(credentialsProvider); topicAdmin.createTopic(topicName); publisher createPublisher(credentialsProvider); subscriberStub createSubscriberStub(credentialsProvider); subscriptionAdminClient createSubscriptionAdmin(credentialsProvider); subscription subscriptionAdminClient.createSubscription(subscriptionName, topicName, PushConfig.getDefaultInstance(), 0); } After public void tearDown() throws Exception { topicAdmin.deleteTopic(topicName); subscriptionAdminClient.deleteSubscription(subscription.getName()); channel.shutdownNow(); } Test public void testLocalPubSub() throws Exception { final String messageText text ; PubsubMessage pubsubMessage PubsubMessage.newBuilder() .setData(ByteString.copyFrom(messageText, Charset.defaultCharset())) .build(); publisher.publish(pubsubMessage).get(); PullRequest pullRequest PullRequest.newBuilder() .setMaxMessages(1) .setReturnImmediately( true ) // if messages are not available immediately return .setSubscription(subscription.getName()) .build(); PullResponse pullResponse subscriberStub.pullCallable().call(pullRequest); String receiveMessageText pullResponse.getReceivedMessages(0).getMessage().getData().toStringUtf8(); Assert.assertEquals(messageText, receiveMessageText); } private TopicAdminClient createTopicAdmin(CredentialsProvider credentialsProvider) throws IOException { return TopicAdminClient.create( TopicAdminSettings.newBuilder() .setTransportChannelProvider(channelProvider) .setCredentialsProvider(credentialsProvider) .build() ); } private SubscriptionAdminClient createSubscriptionAdmin(CredentialsProvider credentialsProvider) throws IOException { SubscriptionAdminSettings subscriptionAdminSettings SubscriptionAdminSettings.newBuilder() .setCredentialsProvider(credentialsProvider) .setTransportChannelProvider(channelProvider) .build(); return SubscriptionAdminClient.create(subscriptionAdminSettings); } private Publisher createPublisher(CredentialsProvider credentialsProvider) throws IOException { return Publisher.newBuilder(topicName) .setChannelProvider(channelProvider) .setCredentialsProvider(credentialsProvider) .build(); } private SubscriberStub createSubscriberStub(CredentialsProvider credentialsProvider) throws IOException { SubscriberStubSettings subscriberStubSettings SubscriberStubSettings.newBuilder() .setTransportChannelProvider(channelProvider) .setCredentialsProvider(credentialsProvider) .build(); return GrpcSubscriberStub.create(subscriberStubSettings); } } 而已。 现在您可以进行一些具有成本效益的单元测试 翻译自: https://www.javacodegeeks.com/2019/09/pub-sub-local-emulator.html
http://www.pierceye.com/news/330552/

相关文章:

  • 深圳网站建设php专门查企业的网站
  • 做问卷调查的网站有啥世界比分榜
  • 网站301定向深圳电梯广告制作公司网站
  • 个人网站做推广系统开发师
  • 智能建站的优势和不足app注册推广拉人
  • 做网站用软件网站制作怎么创业
  • 解放碑电子商务网站建设网站建设英文如何表达
  • 长春好的做网站公司有哪些网站建设标准
  • 公司网站首页大图怎么做台州网站制作定制
  • 网站建设公司软件开发浅谈网站建设开发
  • 松江网站开发培训课程海外域名注册商
  • 智慧景区网站服务建设线下课程seo
  • 做3个网站需要多大的服务器做地铁建设的公司网站
  • 深圳app网站建设哪家好广西桂林
  • 网站开发及上线过程网站建设备案策划书
  • 杭州九鸿科技网站开发网站模板 素材
  • 网站建设网站软件有哪些wordpress如何输入拼音
  • 昆山网站建设哪家便宜简单的模板网站
  • 做图标得英文网站wordpress写代码插件
  • 网站网页设计案例wordprees可以做棋类网站吗
  • 天河区门户网站官网小学生一分钟新闻播报
  • 漯河网站建设lhwzzz网络服务器机柜
  • 有口碑的武进网站建设国内做房车游网站
  • 山东省城乡住房和城乡建设厅网站济南网站建设wuliankj
  • 网站首页跳出弹窗wordpress远程后台设置
  • 免费信息网站建设平台影响网站排名的因素 权重
  • 做房产网站接不到电话湖北网站建设平台
  • 厦门国外网站建设公司排名上海自贸区注册公司优惠政策
  • 网站建设的公司实习做什么成都住建局官网住建智慧建管
  • 建一个免费看电影的网站犯法不国家企业信用信息没有网站怎么做