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

茂名seo站内优化图片制作器手机版

茂名seo站内优化,图片制作器手机版,怎么建国外网站,年会策划方案发布/订阅是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.huolong8.cn/news/54383/

相关文章:

  • 网站开发中网页上传深圳网站快速备案
  • 有专门做房孑特卖的网站吗怎样才能建设网站
  • 杭州网站制作平台高端网站案例网站建设
  • 网站开发技术要学什么软件机械网站建设公司推荐
  • 白云区网站开发公司创造你魔法官方网站起做欢的事
  • 白人与黑人做爰网站社区门户网站规范化建设
  • 公司网站注册流程和费用网络营销推广公司策划方案
  • 郑州网站建设乛汉狮网络网站开发人员的水平
  • 广东网站备案多长时间互联免费虚拟主机
  • 免费的seo网站个人网页html实例完整代码
  • 为何网站不被百度收录市政工程单位工程划分
  • 门户网站开发建设成本明细保险平台
  • 长春建站培训班一级a做爰片免费观看 安全网站
  • 太原找工作网站怎么把qq空间做成企业网站
  • 长沙教育类网站建设光山网站建设
  • 彩虹网站建设天天广告联盟官网
  • 公司集团网站设计怎么做企业推广
  • 营销网站定制公司男科医院网站模板
  • 潜江市网站链接交换平台
  • 网站开发 php模板wordpress 获取当前自定义分类
  • 织梦学校网站简单做网站的价格
  • 文化传播有限公司网站建设南昌企业制作网站设计
  • 各大网站注册阿里建站平台官网
  • 徐州公司网站建设软文范例大全1000字
  • 伪类网站wordpress怎么添加接口
  • 免费个人素材网站wordpress 原理
  • 英文网站开发专业的外贸网站建设公司
  • 海宁长安网站开发网站外链隐形框架
  • ssh框架做的网站问题做网站赚什么钱
  • 东莞专业微网站建设如何制作推广网站