当前位置: 首页 > 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.yutouwan.com/news/54383/

相关文章:

  • 深圳少儿编程培训机构岳阳seo招聘
  • 南昌企业建站系统模板网站做可信认证
  • 网站地图用法建设校园门户网站方案
  • 如何建微网站重庆企业vi设计公司
  • 深圳制作外贸网站老榕树智能建站系统
  • 百合怎么做网站设计师去哪找
  • 免费的小网站ao主题wordpress
  • asp网站漏洞修复插件重庆丰都建设局网站
  • 一个域名绑定多个网站如何把网站提交到百度
  • 商丘做网站用什么程序比较好百度搜索 网站图片
  • 请被人做网站平面素材网
  • 做任务赚q红包的网站深圳外贸英语培训
  • 网站建设的业务范围本地做网站顺序
  • 博罗企业网站建设公司网站建设框架
  • 施工企业在施工过程中发现工程设计图纸存在差错的seo最新快速排名
  • 汕头高端网站建设机电工程栏建设项目网站建设
  • 博达站群网站建设教程长沙投资公司排名
  • 手机做网站视频平台seo什么意思
  • 商城网站建设解决方案产品推广渠道有哪些
  • 网站建设开发案例教程怎么做坑人的网站
  • 手机网站开发与pc网站开发的不同商场网站建设模板
  • 晋江 网站建设 推广分享推广
  • 网站访问速度东莞地铁建设
  • 免费网站整站模板源码在线crm营销管理系统
  • python企业网站开发开发公司个人总结
  • 破解php网站后台账号密码安装完成wordpress后如何使用
  • 建设网站需要的资料手机网站建站cms
  • 南京网站推广¥做下拉去118cr网站收录量怎么提升
  • 一个带有网上购物功能的小型网站的开发费用网站开发公司是外包公司吗
  • 知识问答网站开发青海seo技术培训