You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by se...@apache.org on 2017/12/29 09:18:20 UTC
[incubator-servicecomb-saga] 03/05: SCB-138 removed all thrift
related code
This is an automated email from the ASF dual-hosted git repository.
seanyinx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git
commit 6db355c369e2e95bd7e019a048592c3923e73f8f
Author: seanyinx <se...@huawei.com>
AuthorDate: Fri Dec 29 14:44:50 2017 +0800
SCB-138 removed all thrift related code
Signed-off-by: seanyinx <se...@huawei.com>
---
alpha/alpha-server/pom.xml | 18 -----
.../servicecomb/saga/alpha/server/AlphaConfig.java | 14 ----
.../alpha/server/SwiftTxEventEndpointImpl.java | 52 -------------
.../saga/alpha/server/ThriftStartable.java | 44 -----------
.../saga/alpha/server/AlphaIntegrationTest.java | 32 --------
.../omega-connector/omega-connector-thrift/pom.xml | 67 ----------------
.../connector/thrift/ThriftMessageSender.java | 52 -------------
.../connector/thrift/ThriftMessageSenderTest.java | 88 ----------------------
omega/omega-connector/pom.xml | 1 -
omega/omega-spring-starter/pom.xml | 4 -
.../saga/omega/spring/OmegaSpringConfig.java | 54 -------------
pack-contracts/pack-contract-thrift/pom.xml | 42 -----------
.../saga/pack/contracts/thrift/SwiftTxEvent.java | 85 ---------------------
.../contracts/thrift/SwiftTxEventEndpoint.java | 28 -------
pack-contracts/pom.xml | 1 -
pom.xml | 42 -----------
16 files changed, 624 deletions(-)
diff --git a/alpha/alpha-server/pom.xml b/alpha/alpha-server/pom.xml
index 0c30904..3af09c2 100644
--- a/alpha/alpha-server/pom.xml
+++ b/alpha/alpha-server/pom.xml
@@ -42,18 +42,6 @@
<dependencies>
<dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </dependency>
- <dependency>
- <groupId>com.facebook.swift</groupId>
- <artifactId>swift-service</artifactId>
- </dependency>
- <dependency>
- <groupId>io.servicecomb.saga</groupId>
- <artifactId>pack-contract-thrift</artifactId>
- </dependency>
- <dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
</dependency>
@@ -100,12 +88,6 @@
<build>
<plugins>
-<!--
- <plugin>
- <groupId>com.facebook.mojo</groupId>
- <artifactId>swift-maven-plugin</artifactId>
- </plugin>
--->
<!-- mixin plugin configurations declared in another pom,
just like importing dependencies managed in another pom -->
<plugin>
diff --git a/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/AlphaConfig.java b/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/AlphaConfig.java
index 58ba14a..eca48bc 100644
--- a/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/AlphaConfig.java
+++ b/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/AlphaConfig.java
@@ -17,11 +17,6 @@
package io.servicecomb.saga.alpha.server;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executors;
-
-import javax.annotation.PostConstruct;
-
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -52,15 +47,6 @@ class AlphaConfig {
return eventRepository;
}
- private ServerStartable buildThrift(int port, OmegaCallback omegaCallback, TxEventRepository eventRepository) {
- return new ThriftStartable(
- port,
- new SwiftTxEventEndpointImpl(
- new TxConsistentService(
- eventRepository,
- omegaCallback)));
- }
-
private ServerStartable buildGrpc(int port, OmegaCallback omegaCallback, TxEventRepository eventRepository) {
return new GrpcStartable(
port,
diff --git a/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/SwiftTxEventEndpointImpl.java b/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/SwiftTxEventEndpointImpl.java
index f1f8e40..e69de29 100644
--- a/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/SwiftTxEventEndpointImpl.java
+++ b/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/SwiftTxEventEndpointImpl.java
@@ -1,52 +0,0 @@
-/*
- * 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 io.servicecomb.saga.alpha.server;
-
-import java.util.Date;
-
-import io.servicecomb.saga.alpha.core.TxConsistentService;
-import io.servicecomb.saga.alpha.core.TxEvent;
-import io.servicecomb.saga.pack.contracts.thrift.SwiftTxEvent;
-import io.servicecomb.saga.pack.contracts.thrift.SwiftTxEventEndpoint;
-
-class SwiftTxEventEndpointImpl implements SwiftTxEventEndpoint {
-
- private final TxConsistentService txConsistentService;
-
- SwiftTxEventEndpointImpl(TxConsistentService txConsistentService) {
- this.txConsistentService = txConsistentService;
- }
-
- @Override
- public void handle(SwiftTxEvent message) {
- txConsistentService.handle(new TxEvent(
- new Date(message.timestamp()),
- message.globalTxId(),
- message.localTxId(),
- message.parentTxId(),
- message.type(),
- message.compensationMethod(),
- message.payloads()
- ));
- }
-
- @Override
- public void close() throws Exception {
-
- }
-}
diff --git a/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/ThriftStartable.java b/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/ThriftStartable.java
deleted file mode 100644
index 0da6a5c..0000000
--- a/alpha/alpha-server/src/main/java/io/servicecomb/saga/alpha/server/ThriftStartable.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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 io.servicecomb.saga.alpha.server;
-
-import java.util.Collections;
-
-import com.facebook.swift.codec.ThriftCodecManager;
-import com.facebook.swift.service.ThriftServer;
-import com.facebook.swift.service.ThriftServerConfig;
-import com.facebook.swift.service.ThriftServiceProcessor;
-
-class ThriftStartable implements ServerStartable {
- private final ThriftServer server;
-
- ThriftStartable(int port, Object... services) {
- server = new ThriftServer(
- new ThriftServiceProcessor(new ThriftCodecManager(),
- Collections.emptyList(),
- services),
- new ThriftServerConfig().setPort(port));
- }
-
- @Override
- public void start() {
- Runtime.getRuntime().addShutdownHook(new Thread(server::close));
-
- server.start();
- }
-}
diff --git a/alpha/alpha-server/src/test/java/io/servicecomb/saga/alpha/server/AlphaIntegrationTest.java b/alpha/alpha-server/src/test/java/io/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
index 1be42f9..787b368 100644
--- a/alpha/alpha-server/src/test/java/io/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
+++ b/alpha/alpha-server/src/test/java/io/servicecomb/saga/alpha/server/AlphaIntegrationTest.java
@@ -33,9 +33,7 @@ import java.util.List;
import java.util.Objects;
import java.util.UUID;
-import org.junit.After;
import org.junit.AfterClass;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -55,14 +53,12 @@ import io.servicecomb.saga.alpha.server.AlphaIntegrationTest.OmegaCallbackConfig
import io.servicecomb.saga.pack.contract.grpc.GrpcTxEvent;
import io.servicecomb.saga.pack.contract.grpc.TxEventServiceGrpc;
import io.servicecomb.saga.pack.contract.grpc.TxEventServiceGrpc.TxEventServiceBlockingStub;
-import io.servicecomb.saga.pack.contracts.thrift.SwiftTxEvent;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = {AlphaApplication.class, OmegaCallbackConfig.class}, properties = "alpha.server.port=8090")
public class AlphaIntegrationTest {
private static final int port = 8090;
- // private static final ThriftClientManager clientManager = new ThriftClientManager();
private static ManagedChannel clientChannel = ManagedChannelBuilder
.forAddress("localhost", port).usePlaintext(true).build();
@@ -81,29 +77,13 @@ public class AlphaIntegrationTest {
@Autowired
private List<CompensationContext> compensationContexts;
-// private final FramedClientConnector connector = new FramedClientConnector(fromParts("localhost", port));
-// private SwiftTxEventEndpoint endpoint;
-
-
@AfterClass
public static void tearDown() throws Exception {
clientChannel.shutdown();
-// clientManager.close();
- }
-
- @Before
- public void before() throws Exception {
-// endpoint = clientManager.createClient(connector, SwiftTxEventEndpoint.class).get();
- }
-
- @After
- public void after() throws Exception {
-// endpoint.close();
}
@Test
public void persistsEvent() throws Exception {
-// endpoint.handle(someEvent(TxStartedEvent));
stub.reportEvent(someGrpcEvent(TxStartedEvent));
TxEventEnvelope envelope = eventRepo.findByEventGlobalTxId(globalTxId);
@@ -127,7 +107,6 @@ public class AlphaIntegrationTest {
eventRepo.save(eventEnvelopeOf(TxStartedEvent, localTxId1, UUID.randomUUID().toString(), "service b".getBytes()));
eventRepo.save(eventEnvelopeOf(TxEndedEvent, new byte[0]));
-// endpoint.handle(someEvent(TxAbortedEvent));
stub.reportEvent(someGrpcEvent(TxAbortedEvent));
await().atMost(1, SECONDS).until(() -> compensationContexts.size() > 1);
@@ -137,17 +116,6 @@ public class AlphaIntegrationTest {
));
}
- private SwiftTxEvent someEvent(EventType type) {
- return new SwiftTxEvent(
- System.currentTimeMillis(),
- this.globalTxId,
- this.localTxId,
- this.parentTxId,
- type.name(),
- compensationMethod,
- payload.getBytes());
- }
-
private GrpcTxEvent someGrpcEvent(EventType type) {
return GrpcTxEvent.newBuilder()
.setTimestamp(System.currentTimeMillis())
diff --git a/omega/omega-connector/omega-connector-thrift/pom.xml b/omega/omega-connector/omega-connector-thrift/pom.xml
deleted file mode 100644
index ae64b4a..0000000
--- a/omega/omega-connector/omega-connector-thrift/pom.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>omega-connector</artifactId>
- <groupId>io.servicecomb.saga</groupId>
- <version>0.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>omega-connector-thrift</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </dependency>
- <dependency>
- <groupId>com.facebook.swift</groupId>
- <artifactId>swift-service</artifactId>
- </dependency>
- <dependency>
- <groupId>io.servicecomb.saga</groupId>
- <artifactId>pack-contract-thrift</artifactId>
- </dependency>
- <dependency>
- <groupId>io.servicecomb.saga</groupId>
- <artifactId>omega-transaction</artifactId>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.github.seanyinx</groupId>
- <artifactId>unit-scaffolding</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/omega/omega-connector/omega-connector-thrift/src/main/java/io/servicecomb/saga/omega/connector/thrift/ThriftMessageSender.java b/omega/omega-connector/omega-connector-thrift/src/main/java/io/servicecomb/saga/omega/connector/thrift/ThriftMessageSender.java
index 44499b3..e69de29 100644
--- a/omega/omega-connector/omega-connector-thrift/src/main/java/io/servicecomb/saga/omega/connector/thrift/ThriftMessageSender.java
+++ b/omega/omega-connector/omega-connector-thrift/src/main/java/io/servicecomb/saga/omega/connector/thrift/ThriftMessageSender.java
@@ -1,52 +0,0 @@
-/*
- * 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 io.servicecomb.saga.omega.connector.thrift;
-
-import io.servicecomb.saga.omega.transaction.MessageSender;
-import io.servicecomb.saga.omega.transaction.MessageSerializer;
-import io.servicecomb.saga.omega.transaction.TxEvent;
-import io.servicecomb.saga.pack.contracts.thrift.SwiftTxEvent;
-import io.servicecomb.saga.pack.contracts.thrift.SwiftTxEventEndpoint;
-
-public class ThriftMessageSender implements MessageSender, AutoCloseable {
- private final SwiftTxEventEndpoint eventService;
- private final MessageSerializer serializer;
-
- public ThriftMessageSender(SwiftTxEventEndpoint eventService, MessageSerializer serializer) {
- this.eventService = eventService;
- this.serializer = serializer;
- }
-
- @Override
- public void send(TxEvent event) {
- eventService.handle(new SwiftTxEvent(
- event.timestamp(),
- event.globalTxId(),
- event.localTxId(),
- event.parentTxId(),
- event.type(),
- event.compensationMethod(),
- serializer.serialize(event)
- ));
- }
-
- @Override
- public void close() throws Exception {
- eventService.close();
- }
-}
diff --git a/omega/omega-connector/omega-connector-thrift/src/test/java/io/servicecomb/saga/omega/connector/thrift/ThriftMessageSenderTest.java b/omega/omega-connector/omega-connector-thrift/src/test/java/io/servicecomb/saga/omega/connector/thrift/ThriftMessageSenderTest.java
index 7b5288f..e69de29 100644
--- a/omega/omega-connector/omega-connector-thrift/src/test/java/io/servicecomb/saga/omega/connector/thrift/ThriftMessageSenderTest.java
+++ b/omega/omega-connector/omega-connector-thrift/src/test/java/io/servicecomb/saga/omega/connector/thrift/ThriftMessageSenderTest.java
@@ -1,88 +0,0 @@
-/*
- * 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 io.servicecomb.saga.omega.connector.thrift;
-
-import static com.seanyinx.github.unit.scaffolding.Randomness.uniquify;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import org.junit.Test;
-
-import io.servicecomb.saga.omega.transaction.MessageSerializer;
-import io.servicecomb.saga.omega.transaction.TxEvent;
-import io.servicecomb.saga.pack.contracts.thrift.SwiftTxEvent;
-import io.servicecomb.saga.pack.contracts.thrift.SwiftTxEventEndpoint;
-
-public class ThriftMessageSenderTest {
-
- private final String globalTxId = uniquify("global tx id");
- private final String localTxId = uniquify("local tx id");
- private final String parentTxId = uniquify("parent tx id");
- private final String payload1 = uniquify("payload1");
- private final String payload2 = uniquify("payload2");
-
- private SwiftTxEvent swiftTxEvent;
-
- private final MessageSerializer serializer = new MessageSerializer() {
- @Override
- public byte[] serialize(TxEvent event) {
- return serialize(event.payloads());
- }
-
- @Override
- public byte[] serialize(Object[] objects) {
- try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) {
- for (Object o : objects) {
- stream.write(o.toString().getBytes());
- }
- return stream.toByteArray();
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
- }
- };
-
- private final SwiftTxEventEndpoint eventService = new SwiftTxEventEndpoint() {
- @Override
- public void handle(SwiftTxEvent message) {
- swiftTxEvent = message;
- }
-
- @Override
- public void close() throws Exception {
- }
- };
-
- private final ThriftMessageSender messageSender = new ThriftMessageSender(eventService, serializer);
-
- @Test
- public void sendSerializedEvent() throws Exception {
- TxEvent event = new TxEvent(globalTxId, localTxId, parentTxId, getClass().getCanonicalName(), payload1, payload2);
-
- messageSender.send(event);
-
- assertThat(swiftTxEvent.globalTxId(), is(event.globalTxId()));
- assertThat(swiftTxEvent.localTxId(), is(event.localTxId()));
- assertThat(swiftTxEvent.parentTxId(), is(event.parentTxId()));
- assertThat(swiftTxEvent.compensationMethod(), is(event.compensationMethod()));
- assertThat(swiftTxEvent.payloads(), is(serializer.serialize(event)));
- }
-}
diff --git a/omega/omega-connector/pom.xml b/omega/omega-connector/pom.xml
index 63ceda6..9d0c4e7 100644
--- a/omega/omega-connector/pom.xml
+++ b/omega/omega-connector/pom.xml
@@ -29,7 +29,6 @@
<artifactId>omega-connector</artifactId>
<packaging>pom</packaging>
<modules>
- <module>omega-connector-thrift</module>
<module>omega-connector-grpc</module>
</modules>
diff --git a/omega/omega-spring-starter/pom.xml b/omega/omega-spring-starter/pom.xml
index 40767ba..b0f2854 100644
--- a/omega/omega-spring-starter/pom.xml
+++ b/omega/omega-spring-starter/pom.xml
@@ -35,10 +35,6 @@
</dependency>
<dependency>
<groupId>io.servicecomb.saga</groupId>
- <artifactId>omega-connector-thrift</artifactId>
- </dependency>
- <dependency>
- <groupId>io.servicecomb.saga</groupId>
<artifactId>omega-format</artifactId>
</dependency>
<dependency>
diff --git a/omega/omega-spring-starter/src/main/java/io/servicecomb/saga/omega/spring/OmegaSpringConfig.java b/omega/omega-spring-starter/src/main/java/io/servicecomb/saga/omega/spring/OmegaSpringConfig.java
index 3f3460c..9b749fd 100644
--- a/omega/omega-spring-starter/src/main/java/io/servicecomb/saga/omega/spring/OmegaSpringConfig.java
+++ b/omega/omega-spring-starter/src/main/java/io/servicecomb/saga/omega/spring/OmegaSpringConfig.java
@@ -17,13 +17,8 @@
package io.servicecomb.saga.omega.spring;
-import static com.google.common.net.HostAndPort.fromParts;
-
import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
import javax.annotation.PreDestroy;
@@ -33,14 +28,10 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import com.facebook.nifty.client.FramedClientConnector;
-import com.facebook.swift.service.ThriftClientManager;
-
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.servicecomb.saga.omega.connector.grpc.GrpcClientMessageSender;
import io.servicecomb.saga.omega.connector.grpc.GrpcTxEventEndpointImpl;
-import io.servicecomb.saga.omega.connector.thrift.ThriftMessageSender;
import io.servicecomb.saga.omega.context.IdGenerator;
import io.servicecomb.saga.omega.context.OmegaContext;
import io.servicecomb.saga.omega.context.UniqueIdGenerator;
@@ -49,13 +40,10 @@ import io.servicecomb.saga.omega.transaction.MessageSender;
import io.servicecomb.saga.omega.transaction.MessageSerializer;
import io.servicecomb.saga.pack.contract.grpc.TxEventServiceGrpc;
import io.servicecomb.saga.pack.contract.grpc.TxEventServiceGrpc.TxEventServiceBlockingStub;
-import io.servicecomb.saga.pack.contracts.thrift.SwiftTxEventEndpoint;
@Configuration
class OmegaSpringConfig {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- private final ThriftClientManager clientManager = new ThriftClientManager();
- private final List<AutoCloseable> closeables = new ArrayList<>();
private ManagedChannel clientChannel;
@@ -69,50 +57,8 @@ class OmegaSpringConfig {
return new OmegaContext(idGenerator);
}
- // @Bean
- MessageSender messageSender(@Value("${alpha.cluster.address}") String[] addresses) {
- // TODO: 2017/12/26 connect to the one with lowest latency
- for (String address : addresses) {
- try {
- String[] pair = address.split(":");
- ThriftMessageSender sender = createMessageSender(clientManager, pair[0], Integer.parseInt(pair[1]), new NativeMessageFormat());
- closeables.add(sender);
- return sender;
- } catch (Exception e) {
- log.error("Unable to connect to alpha at {}", address, e);
- }
- }
-
- throw new IllegalArgumentException(
- "None of the alpha cluster is reachable: " + Arrays.toString(addresses));
- }
-
- private ThriftMessageSender createMessageSender(ThriftClientManager clientManager,
- String host,
- int port,
- MessageSerializer serializer) {
-
- FramedClientConnector connector = new FramedClientConnector(fromParts(host, port));
-
- try {
- SwiftTxEventEndpoint endpoint = clientManager.createClient(connector, SwiftTxEventEndpoint.class).get();
- return new ThriftMessageSender(endpoint, serializer);
- } catch (InterruptedException | ExecutionException e) {
- throw new IllegalStateException("Failed to create transaction event endpoint client to " + host + ":" + port, e);
- }
- }
-
@PreDestroy
void close() {
- for (AutoCloseable closeable : closeables) {
- try {
- closeable.close();
- } catch (Exception e) {
- log.warn("Failed to close message sender", e);
- }
- }
-
- clientManager.close();
clientChannel.shutdown();
}
diff --git a/pack-contracts/pack-contract-thrift/pom.xml b/pack-contracts/pack-contract-thrift/pom.xml
deleted file mode 100644
index 051aaf1..0000000
--- a/pack-contracts/pack-contract-thrift/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>pack-contracts</artifactId>
- <groupId>io.servicecomb.saga</groupId>
- <version>0.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>pack-contract-thrift</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </dependency>
- <dependency>
- <groupId>com.facebook.swift</groupId>
- <artifactId>swift-service</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/pack-contracts/pack-contract-thrift/src/main/java/io/servicecomb/saga/pack/contracts/thrift/SwiftTxEvent.java b/pack-contracts/pack-contract-thrift/src/main/java/io/servicecomb/saga/pack/contracts/thrift/SwiftTxEvent.java
index 9395142..e69de29 100644
--- a/pack-contracts/pack-contract-thrift/src/main/java/io/servicecomb/saga/pack/contracts/thrift/SwiftTxEvent.java
+++ b/pack-contracts/pack-contract-thrift/src/main/java/io/servicecomb/saga/pack/contracts/thrift/SwiftTxEvent.java
@@ -1,85 +0,0 @@
-/*
- * 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 io.servicecomb.saga.pack.contracts.thrift;
-
-import com.facebook.swift.codec.ThriftConstructor;
-import com.facebook.swift.codec.ThriftField;
-import com.facebook.swift.codec.ThriftStruct;
-
-@ThriftStruct("TxEvent")
-public class SwiftTxEvent {
- private final long timestamp;
- private final String globalTxId;
- private final String localTxId;
- private final String parentTxId;
- private final String type;
- private final byte[] payloads;
- private final String compensationMethod;
-
- @ThriftConstructor
- public SwiftTxEvent(long timestamp,
- String globalTxId,
- String localTxId,
- String parentTxId,
- String type,
- String compensationMethod,
- byte[] payloads) {
- this.timestamp = timestamp;
- this.globalTxId = globalTxId;
- this.localTxId = localTxId;
- this.parentTxId = parentTxId;
- this.type = type;
- this.payloads = payloads;
- this.compensationMethod = compensationMethod;
- }
-
- @ThriftField(1)
- public long timestamp() {
- return timestamp;
- }
-
- @ThriftField(2)
- public String globalTxId() {
- return globalTxId;
- }
-
- @ThriftField(3)
- public String localTxId() {
- return localTxId;
- }
-
- @ThriftField(4)
- public String parentTxId() {
- return parentTxId;
- }
-
- @ThriftField(5)
- public String type() {
- return type;
- }
-
- @ThriftField(6)
- public String compensationMethod() {
- return compensationMethod;
- }
-
- @ThriftField(7)
- public byte[] payloads() {
- return payloads;
- }
-}
diff --git a/pack-contracts/pack-contract-thrift/src/main/java/io/servicecomb/saga/pack/contracts/thrift/SwiftTxEventEndpoint.java b/pack-contracts/pack-contract-thrift/src/main/java/io/servicecomb/saga/pack/contracts/thrift/SwiftTxEventEndpoint.java
deleted file mode 100644
index ae1fde9..0000000
--- a/pack-contracts/pack-contract-thrift/src/main/java/io/servicecomb/saga/pack/contracts/thrift/SwiftTxEventEndpoint.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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 io.servicecomb.saga.pack.contracts.thrift;
-
-import com.facebook.swift.service.ThriftMethod;
-import com.facebook.swift.service.ThriftService;
-
-@ThriftService("TxEventEndpoint")
-public interface SwiftTxEventEndpoint extends AutoCloseable {
-
- @ThriftMethod
- void handle(SwiftTxEvent message);
-}
diff --git a/pack-contracts/pom.xml b/pack-contracts/pom.xml
index b6ad03c..dc2acd8 100644
--- a/pack-contracts/pom.xml
+++ b/pack-contracts/pom.xml
@@ -29,7 +29,6 @@
<artifactId>pack-contracts</artifactId>
<packaging>pom</packaging>
<modules>
- <module>pack-contract-thrift</module>
<module>pack-contract-grpc</module>
</modules>
diff --git a/pom.xml b/pom.xml
index 8fb9f63..8c4e15a 100755
--- a/pom.xml
+++ b/pom.xml
@@ -154,11 +154,6 @@
</dependency>
<dependency>
<groupId>io.servicecomb.saga</groupId>
- <artifactId>omega-connector-thrift</artifactId>
- <version>0.0.3-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>io.servicecomb.saga</groupId>
<artifactId>omega-connector-grpc</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>
@@ -184,11 +179,6 @@
</dependency>
<dependency>
<groupId>io.servicecomb.saga</groupId>
- <artifactId>pack-contract-thrift</artifactId>
- <version>0.0.3-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>io.servicecomb.saga</groupId>
<artifactId>pack-contract-grpc</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>
@@ -313,26 +303,6 @@
<version>${akka.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- <version>0.10.0</version>
- </dependency>
- <dependency>
- <groupId>com.facebook.swift</groupId>
- <artifactId>swift-service</artifactId>
- <version>0.23.1</version>
- <exclusions>
- <exclusion>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.bval</groupId>
- <artifactId>bval-jsr303</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>${grpc.version}</version>
@@ -543,18 +513,6 @@
<version>2.8.2</version>
</plugin>
<plugin>
- <groupId>com.facebook.mojo</groupId>
- <artifactId>swift-maven-plugin</artifactId>
- <version>0.23.1</version>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
--
To stop receiving notification emails like this one, please contact
"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>.