[ 
https://issues.apache.org/jira/browse/SCB-926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16621467#comment-16621467
 ] 

ASF GitHub Bot commented on SCB-926:
------------------------------------

liubao68 commented on a change in pull request #915: [SCB-926] support invoking 
3rd party service
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/915#discussion_r219026316
 
 

 ##########
 File path: 
integration-tests/it-consumer/src/main/java/org/apache/servicecomb/it/testcase/thirdparty/Test3rdPartyInvocation.java
 ##########
 @@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.it.testcase.thirdparty;
+
+import java.util.Collections;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+
+import javax.ws.rs.CookieParam;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.QueryParam;
+import javax.xml.ws.Holder;
+
+import org.apache.servicecomb.it.extend.engine.GateRestTemplate;
+import org.apache.servicecomb.provider.pojo.Invoker;
+import org.apache.servicecomb.provider.springmvc.reference.RestTemplateBuilder;
+import 
org.apache.servicecomb.provider.springmvc.reference.async.CseAsyncRestTemplate;
+import org.apache.servicecomb.serviceregistry.RegistryUtils;
+import 
org.apache.servicecomb.serviceregistry.api.registry.MicroserviceInstance;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.util.concurrent.ListenableFuture;
+import org.springframework.web.client.RestTemplate;
+
+public class Test3rdPartyInvocation {
+
+  private static final String THIRD_PARTY_MICROSERVICE_NAME = 
"3rdPartyDataTypeJaxrs";
+
+  private static final String ASYNC_THIRD_PARTY_MICROSERVICE_NAME = 
THIRD_PARTY_MICROSERVICE_NAME + "Async";
+
+  // to get endpoint from urlPrefix
+  static GateRestTemplate rt = (GateRestTemplate) 
GateRestTemplate.createEdgeRestTemplate("dataTypeJaxrs");
+
+  private static DataTypeJaxrsSchemaIntf dataTypeJaxrsSchema;
+
+  private static DataTypeJaxrsSchemaAsyncIntf dataTypeJaxrsSchemaAsync;
+
+  @BeforeClass
+  public static void beforeClass() {
+    String urlPrefix = rt.getUrlPrefix();
+    int beginIndex = urlPrefix.indexOf("//");
+    int endIndex = urlPrefix.indexOf("/", beginIndex + 3);
+    String endpoint = "rest:" + urlPrefix.substring(beginIndex, endIndex);
+    RegistryUtils.getServiceRegistry()
+        .registryMicroserviceMappingByEndpoints(
+            THIRD_PARTY_MICROSERVICE_NAME, "1.2.1", 
DataTypeJaxrsSchemaIntf.class,
+            Collections.singletonList(endpoint));
+
+    MicroserviceInstance instance = new MicroserviceInstance();
+    instance.setEndpoints(Collections.singletonList(endpoint));
+    RegistryUtils.getServiceRegistry()
 
 Review comment:
   There are two scenarios need to consider:
   1. consumers register producers endpoints and schemas
   2. consumers register only schemas,  this is quite common in mesher mode 
which the service is already registered to service center but schemas are not, 
and used very widely
   
   Can we provide scenario 2 support?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Invoke 3rd party service
> ------------------------
>
>                 Key: SCB-926
>                 URL: https://issues.apache.org/jira/browse/SCB-926
>             Project: Apache ServiceComb
>          Issue Type: New Feature
>    Affects Versions: java-chassis-1.1.0
>            Reporter: YaoHaishi
>            Assignee: YaoHaishi
>            Priority: Major
>
> Provide a interface to let users specify 3rd party services' endpoints and 
> let users can invoke 3rd party service like invoking the ServiceComb 
> microservice.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to