【问题标题】:how to cache RESTful requests and JSON responses using wso2 ESB如何使用 wso2 ESB 缓存 RESTful 请求和 JSON 响应
【发布时间】:2016-03-14 14:39:44
【问题描述】:

哪些 wso2 中介和包类实现 JSON/REST/HTTP 友好缓存?例如,读取 HTTP 标头和 URI 以识别 GET 命令上的缓存键,解析 JSON(而不是 XML)以使集合 POST 上的缓存条目无效(使用有效负载中的键),并符合标准 HTTP/1.1 标头方案(即@987654321 @) ??

【问题讨论】:

    标签: api caching wso2 wso2esb mediator


    【解决方案1】:

    您可以使用来自 WSO2 ESB 的Cache Mediator

    <sequence name="SEQ_CACHE">
      <in>
        <cache scope="per-host"
          collector="false"
          hashGenerator="org.wso2.caching.digest.DOMHASHGenerator"
          timeout="20">
          <implementation type="memory" maxSize="100"/>
        </cache>
    
        <send>
          <endpoint>
            <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
          </endpoint>
        </send>
      </in>
    
      <out>
        <cache scope="per-host" collector="true"/>
        <send/>
      </out>
    </sequence>
    

    【讨论】:

    • Waqas,我明确提到了 REST 和 JSON。 SimpleStockQuoteService 使用 XML 和 SOAP。样本不适用。
    • 这只是一个示例。我相信 WSO2 ESB 缓存中介也可以适用于 JSON。你试过吗?
    • 我尝试了 WSO2 ESB 缓存中介,但它不起作用。查询字符串参数没有触发一个新的、不同的 DOMHash。新的 URI 不会触发新的、不同的 DOMHash。
    • 这个问题和stackoverflow.com/questions/35150859/…类似,也没有解决
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-30
    相关资源
    最近更新 更多