惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
N
Netflix TechBlog - Medium
罗磊的独立博客
F
Fortinet All Blogs
T
Threatpost
Y
Y Combinator Blog
博客园_首页
美团技术团队
Security Latest
Security Latest
博客园 - 三生石上(FineUI控件)
T
Tailwind CSS Blog
V
V2EX - 技术
The Cloudflare Blog
L
LINUX DO - 热门话题
博客园 - 司徒正美
Jina AI
Jina AI
P
Proofpoint News Feed
宝玉的分享
宝玉的分享
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cybersecurity and Infrastructure Security Agency CISA
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
WordPress大学
WordPress大学
The Hacker News
The Hacker News
P
Privacy International News Feed
T
The Exploit Database - CXSecurity.com
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence
Latest news
Latest news
NISL@THU
NISL@THU
Google DeepMind News
Google DeepMind News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cisco Blogs
雷峰网
雷峰网
Application and Cybersecurity Blog
Application and Cybersecurity Blog
B
Blog RSS Feed
W
WeLiveSecurity
D
DataBreaches.Net
G
Google Developers Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
GRAHAM CLULEY
Spread Privacy
Spread Privacy
Know Your Adversary
Know Your Adversary
TaoSecurity Blog
TaoSecurity Blog
S
Securelist
Help Net Security
Help Net Security

博客园 - 公元前

好利吧:淘宝店家会不会是提高了宝贝价格所以才给返利的钱? 好利吧:淘宝返利的钱从哪里来的?是我多付了钱吗? 好利吧:告诉你一个不一样的购物方式 利用JQuery的$.ajax()可以很方便的调用asp.net的后台方法 MS SQL Server时间常用函数 - 公元前 云主机是什么? 分享最新最全建站教程资料及相关的软件 ASP.NET如何获取根目录的方法汇总 诚聘wpf UI 软件研发工程师 诚聘图像可视化软件开发工程师 诚招C#软件开发工程师 房租支付平台“租房宝”获千万投资 亚马逊发力,电商的竞争由价格转向了物流 未来团购网的发展方向:垂直化细分 做网站需要持之以恒 - 公元前 分享:从百度K站到恢复收录的10点经验教训 - 公元前 如何提升被降权网站的权重恢复网站主页排名 - 公元前 网站修改标题之后会怎么样 - 公元前 深度seo优化的悲剧 - 公元前
TOPAPI 消息通知机制
公元前 · 2013-08-21 · via 博客园 - 公元前

接收用户订阅消息


        public class UserSubMain {

            public static void main(String[] args ) throws ApiException  {
                String appKey="1021036310";
                String appSecret="sandboxdc954ee217f6ad0ac192f436f";
                String serverUrl = "http://gw.api.tbsandbox.com/router/rest";

                DefaultTaobaoClient client = new DefaultTaobaoClient(serverUrl , appKey , appSecret, "xml");
                
                IncrementCustomerPermitRequest req = new IncrementCustomerPermitRequest();
                req.setStatus("all;all;all");
                req.setTopics("trade;refund;item");
                req.setType("get,syn,notify");
                System.out.print((client.execute(req, "61017155c02b94c4f80e4611222c34f33b6076f29b063992074082786")).getBody());
            }
        }
    

监听类


        import com.taobao.api.internal.stream.connect.ConnectionLifeCycleListener;
        public class DefaultConnectionLifeCycleListener implements ConnectionLifeCycleListener {
            public void onBeforeConnect() {
                System.out.println("connect start ");
            }
            public void onConnect() {
                System.out.println("connecting ");
            }
            public void onException(Throwable throwable) {
                System.out.println("connecting error:  " + throwable);
            }
            public void onConnectError(Exception e) {
                System.out.println("connecting error:  " + e);
            }
            public void onReadTimeout() {
                System.out.println("connecting timeout");
            }
            public void onMaxReadTimeoutException() {
                System.out.println("onMaxReadTimeoutException");
            }
            public void onSysErrorException(Exception e) {
                System.out.println("onSysErrorException error:  " + e);
            }
        }
    

监听类


        import com.taobao.api.internal.stream.message.TopCometMessageListener;
        public class DefaultTopCometMessageListener implements TopCometMessageListener{
            public void onConnectMsg(String message) {
                System.out.println("connecting onConnectMsg:  " + message);
            }
            public void onHeartBeat() {}

            public void onReceiveMsg(String message) {
                System.out.println("connecting onReceiveMsg:  " + message); 
            }
            public void onConnectReachMaxTime() {}

            public void onDiscardMsg(String message) {
                System.out.println("connecting onDiscardMsg:  " + message);
            }

            public void onServerUpgrade(String message) {
                System.out.println("connecting onServerUpgrade:  " + message);
            }

            public void onServerRehash() {  }

            public void onServerKickOff() { }

            public void onClientKickOff() { }

            public void onOtherMsg(String message) {
                System.out.println("connecting onOtherMsg:  " + message);
            }
            public void onException(Exception ex) { }
        }

    

订阅消息


        import com.taobao.api.internal.stream.Configuration;
        import com.taobao.api.internal.stream.TopCometStream;
        import com.taobao.api.internal.stream.TopCometStreamFactory;
        public class ComentMain {
            public static void main(String[] args )  {
                String appKey="1021036310";
                String appSecret="sandboxdc954ee217f6ad0ac192f436f";
                Configuration conf = new Configuration(appKey,appSecret,null);
                conf.setConnectUrl("http://stream.api.tbsandbox.com/stream");
                TopCometStream stream = new TopCometStreamFactory(conf).getInstance();
                stream.setConnectionListener(new DefaultConnectionLifeCycleListener());
                stream.setMessageListener(new DefaultTopCometMessageListener());
                stream.start();
            }
        }