apollo

Apollo Client Write Query Not Updating UI

試著忘記壹切 提交于 2019-12-01 09:17:37
We are building an offline first React Native Application with Apollo Client. Currently I am trying to update the Apollo Cache directly when offline to update the UI optimistically. Since we offline we do not attempt to fire the mutation until connect is "Online" but would like the UI to reflect these changes prior to the mutation being fired while still offline. We are using the readQuery / writeQuery API functions from http://dev.apollodata.com/core/read-and-write.html#writequery-and-writefragment . and are able to view the cache being updated via Reacotron, however, the UI does not update

Apache-apollo部署

烂漫一生 提交于 2019-12-01 08:43:17
一、安装 jdk环境 二、下载并安装 apache-apollo 1、makdir /opt 2、cd /opt 3、apache-apollo下载地址 wget http://archive.apache.org/dist/activemq/activemq-apollo/1.7.1/apache-apollo-1.7.1-unix-distro.tar.gz 下载后在想要安装的目录下解压 4、tar -zxvf apache-apollo-1.7.1-unix-distro.tar.gz 二、创建实例 1、在bin目录下,创建实例 注:此目录为本人安装目录 cd /opt/apache-apollo-1.7.1/bin 2、执行./apollo create mybroker 创建了实例mybroker 三、修改配置文件 1、编辑实例目录下的etc目录下的apollo.xml文件 执行 vim /opt/apache-apollo-1.7.1/bin/mybroker/etc/apollo.xml 将 <web_admin bind=" http://127.0.0.1:61680 "/> <web_admin bind=" https://127.0.0.1:61681 "/> 修改为 <web_admin bind=" http://0.0.0.0:61680 "/>

spring cloud config 配置中心(一)

旧巷老猫 提交于 2019-12-01 03:35:34
微服务的基础服务之一,可以使用Apollo 代替,后续补充,也可以自己搭建 https://github.com/ctripcorp/apollo spring 基础功能不做简介,只说关键点: 第一步:依赖包 <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> </dependency> 第二步:启动类,加注释,熟悉的套路不多说 @SpringBootApplication @EnableConfigServer public class SpringcloudconfigserverApplication { public static void main(String[] args) { SpringApplication.run(SpringcloudconfigserverApplication.class, args); } } 第三步:配置文件(方便测试采用的本地git库,远程的话需要配置账户密码) ### 配置服务器配置项 spring.application.name = config-server ### 定义HTTP服务端口 server.port = 9090 ### 本地仓库的GIT URI

配置中心-Apollo

[亡魂溺海] 提交于 2019-12-01 02:33:47
配置中心-Apollo 2019/10/01 Chenxin 配置服务主要有 携程Apollo、百度Disconf、阿里ACM,目前以Apollo用户量最大.适用场景,多用于微服务,与K8S结合好. 携程Apollo https://github.com/ctripcorp/apollo Apollo - A reliable configuration management system. Apollo(阿波罗)是携程框架部门研发的分布式配置中心,能够集中化管理应用不同环境、不同集群的配置,配置修改后能够实时推送到应用端,并且具备规范的权限、流程治理等特性,适用于微服务配置管理场景。服务端基于Spring Boot和Spring Cloud开发,打包后可以直接运行,不需要额外安装Tomcat等应用容器。 Java客户端不依赖任何框架,能够运行于所有Java运行时环境,同时对Spring/Spring Boot环境也有较好的支持。 .Net客户端不依赖任何框架,能够运行于所有.Net运行时环境。 百度Disconf https://github.com/knightliao/disconf Disconf - Distributed Configuration Management Platform(分布式配置管理平台).

Apollo client mutation error handling

不打扰是莪最后的温柔 提交于 2019-12-01 00:58:00
问题 I'm using GraphQL and mongoose on the server. When a validation error occurs the GraphQL mutation sends a response with status code 200. On the client side the response looks like this: { "data": null, "errors": [{ "message": "error for id...", "path": "_id" }] } I would like to get access to the validation error using the catch functionality of the apollo-client mutation promise. Something like: this.props.deleteProduct(this.state.selectedProductId).then(response => { // handle successful

How to chain together Mutations in apollo client

柔情痞子 提交于 2019-11-30 23:08:46
I have a bunch of information stored in my state that I need to pass to my graphQL server using mutations, but I need to use the results of each mutation before I call the next one since I need to: Create a new object in my database Use the id generated for that object to create another object Modify the original object to store the id generated by the second object I noticed that apollo Mutation components have an onCompleted callback, but I don't know how to use this callback to fire off another mutation or whether it's the right way solve my problem. I also looked into batching my mutations

GraphQL how to avoid duplicate code between input and output types

纵饮孤独 提交于 2019-11-30 19:31:09
I'am new to GraphQL but I really like it. Now that I'am playing with interfaces and unions, I'am facing a problem with mutations. Suppose that I have this schema : interface FoodType { id: String type: String composition: [Ingredient] } type Pizza implements FoodType { id: String type: String pizzaType: String toppings: [String] size: String composition: [Ingredient] } type Salad implements FoodType { id: String type: String vegetarian: Boolean dressing: Boolean composition: [Ingredient] } type BasicFood implements FoodType { id: String type: String composition: [Ingredient] } type Ingredient

Spring Boot 集成 Apollo 报 [Cause: [status code: 404] Could not find config for namespace

梦想的初衷 提交于 2019-11-30 12:52:54
Spring Boot 集成 Apollo 报如下异常: 10:11:21.891 [main] WARN c.c.f.a.i.RemoteConfigRepository - Load config failed, will retry in 1 SECONDS. appId: 201909261015778899, cluster: platform-tw, namespaces: application 10:11:35.087 [main] WARN c.c.f.apollo.internals.DefaultConfig - Could not load config for namespace application from Apollo, please check whether the configs are released in Apollo! Return default value now! 10:12:28.291 [Apollo-RemoteConfigRepository-1] WARN c.c.f.a.i.AbstractConfigRepository - Sync config failed, will retry. Repository class com.ctrip.framework.apollo.internals

asp.net core系列 73 Exceptionless+Nlog以及Apollo介绍

拜拜、爱过 提交于 2019-11-30 11:52:09
原文: asp.net core系列 73 Exceptionless+Nlog以及Apollo介绍 一. 介绍   在一上篇中介绍了Exceptionless的基本使用,这篇主要讲 Exceptionless 结合 Nlog 的实现双重日志记录,包括 Exceptionles 的 UI 可视化日志以及 Nlog 的 txt 文件日志。再是从 Apollo 配置中心读取配置文件,当系统越庞大越多时,需要配置的参数也越来越多,可以通过使用 Apollo 配置中心来统一管理,例如:配置数据库连接地址、 Exceptionless 的对应项目的 apikey 值, redis 连接地址等等所有可配置的参数。    1.1 asp.net core中 Apollo 配置     打开asp.net core 项目,删除 appsettings.json 文件默认内容,在添加配置如下所示: { "apollo": { "AppId": "100001", "MetaServer": "http://192.168.0.100:8080/", "Env": "Dev", "Meta": { "DEV": "http://192.168.0.100:8080/", "FAT": "http://192.168.0.100:8080/", "UAT": "http://192.168.0.100

springmvc - 通过DeferredResult实现长轮询服务端推送消息

我的未来我决定 提交于 2019-11-30 06:23:41
DeferredResult字面意思就是推迟结果,是在servlet3.0以后引入了异步请求之后,spring封装了一下提供了相应的支持,也是一个很老的特性了。DeferredResult可以允许容器线程快速释放以便可以接受更多的请求提升吞吐量,让真正的业务逻辑在其他的工作线程中去完成。 最近再看apollo配置中心的实现原理,apollo的发布配置推送变更消息就是用DeferredResult实现的,apollo客户端会像服务端发送长轮训http请求,超时时间60秒,当超时后返回客户端一个304 httpstatus,表明配置没有变更,客户端继续这个步骤重复发起请求,当有发布配置的时候,服务端会调用DeferredResult.setResult返回200状态码,然后轮训请求会立即返回(不会超时),客户端收到响应结果后,会发起请求获取变更后的配置信息。 下面我们自己写一个简单的demo来演示这个过程 @SpringBootApplication public class DemoApplication implements WebMvcConfigurer { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } @Bean public