pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] tuteng opened a new pull request #2998: support mysql binlog sync to pulsar by canal
Date Fri, 16 Nov 2018 11:03:43 GMT
tuteng opened a new pull request #2998: support mysql binlog sync to pulsar by canal
URL: https://github.com/apache/pulsar/pull/2998
 
 
   ### Motivation
   
   support alibaba canal
   https://github.com/alibaba/canal/wiki
   
   ### Modifications
   
   Integrated canal client
   
   ### Result
   
   support binlog sync to pulsar
   use pulsar-client to consume
   
   ```
   import pulsar
   
   client = pulsar.Client('pulsar://localhost:6650')
   consumer = client.subscribe('my-topic',
                               subscription_name='my-sub')
   
   while True:
       msg = consumer.receive()
       print("Received message: '%s'" % msg.data())
       consumer.acknowledge(msg)
   
   client.close()
   
   output:
   Received message: '{"data":null,"database":"mclouds","es":1542365653000,"id":34,"isDdl":true,"mysqlType":null,"old":null,"sql":"CREATE
TABLE `users319` (   `id` int(11) NOT NULL AUTO_INCREMENT,   `name` varchar(50) DEFAULT NULL,
  `extra` varchar(50) DEFAULT NULL,   PRIMARY KEY (`id`),   KEY `ix_users_name` (`name`) )
ENGINE=InnoDB DEFAULT CHARSET=utf8","sqlType":null,"table":"users319","ts":1542365655154,"type":"CREATE"}'
   ```
   
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message