Search in sources :

Example 1 with CanalServerWithEmbedded

use of com.alibaba.otter.canal.server.embedded.CanalServerWithEmbedded in project canal by alibaba.

the class CanalServerTest method setUp.

@Before
public void setUp() {
    CanalServerWithEmbedded embeddedServer = new CanalServerWithEmbedded();
    embeddedServer.setCanalInstanceGenerator(destination -> {
        Canal canal = buildCanal();
        return new CanalInstanceWithManager(canal, FILTER);
    });
    nettyServer = CanalServerWithNetty.instance();
    nettyServer.setEmbeddedServer(embeddedServer);
    nettyServer.setPort(1088);
    nettyServer.start();
}
Also used : CanalServerWithEmbedded(com.alibaba.otter.canal.server.embedded.CanalServerWithEmbedded) Canal(com.alibaba.otter.canal.instance.manager.model.Canal) CanalInstanceWithManager(com.alibaba.otter.canal.instance.manager.CanalInstanceWithManager) Before(org.junit.Before)

Example 2 with CanalServerWithEmbedded

use of com.alibaba.otter.canal.server.embedded.CanalServerWithEmbedded in project canal by alibaba.

the class CanalServerWithNettyTest method setUp.

@Before
public void setUp() {
    CanalServerWithEmbedded embeddedServer = new CanalServerWithEmbedded();
    embeddedServer.setCanalInstanceGenerator(new CanalInstanceGenerator() {

        public CanalInstance generate(String destination) {
            Canal canal = buildCanal();
            return new CanalInstanceWithManager(canal, FILTER);
        }
    });
    nettyServer = CanalServerWithNetty.instance();
    nettyServer.setEmbeddedServer(embeddedServer);
    nettyServer.setPort(1088);
    nettyServer.start();
}
Also used : CanalInstance(com.alibaba.otter.canal.instance.core.CanalInstance) CanalServerWithEmbedded(com.alibaba.otter.canal.server.embedded.CanalServerWithEmbedded) Canal(com.alibaba.otter.canal.instance.manager.model.Canal) CanalInstanceGenerator(com.alibaba.otter.canal.instance.core.CanalInstanceGenerator) CanalInstanceWithManager(com.alibaba.otter.canal.instance.manager.CanalInstanceWithManager) Before(org.junit.Before)

Aggregations

CanalInstanceWithManager (com.alibaba.otter.canal.instance.manager.CanalInstanceWithManager)2 Canal (com.alibaba.otter.canal.instance.manager.model.Canal)2 CanalServerWithEmbedded (com.alibaba.otter.canal.server.embedded.CanalServerWithEmbedded)2 Before (org.junit.Before)2 CanalInstance (com.alibaba.otter.canal.instance.core.CanalInstance)1 CanalInstanceGenerator (com.alibaba.otter.canal.instance.core.CanalInstanceGenerator)1