Generic service control interface

I need an interface to a back-end service, mostly for control commands (stop, status, cancel, reload config). The service might be in Python, Perl, Java, or whatever, and runs continuously. The interface will let me send infrequent commands to the running process.

A signal handler can tell a process to stop, and USR1 and USR2 signals let it do two more things. Tomcat sets up a special listener on a fixed port number to get it to shutdown, perhaps due to limitations of Java signal handling.

But I’d like it to respond, not just react. And I’d like to use this for a service written in any language on any platform. I’m hoping to avoid middleware or databases to communicate, since it’s a simply request/response (Q: “how are you?” / A: “I have been running for 3 hours at peak efficiency”).

I glanced at these but they seem like overkill for a simple control interface:

  • dBus – general interprocess message bus
  • UPnP – device communciation
  • Avahi – DNS queries to find services
  • Hadoop YARN – Distributes work across a network, parallel processing

Each seem compelling, but they feel heavy weight or else require special software to be installed ahead of time, or aren’t for every language or every platform.

If I wrote my own, I could write a single-threaded TCP listener with JSON requests/responses. That seems about as lightweight and universal as you can get, and is small enough for a “hello world” service, and big enough for speaking to any service. JSON over TCP would be very command-line friendly (curl or netcat), and therefore easily scriptable. Lots of languages already have a JSON library (C++, Java, etc), in any platform.

A harder approach is adding HTTP semantics to the JSON request/response so you could browse to your application or use curl to control it. But embedding HTTP seems like a lot of space and complexity when it will only support a few resources (PUT text/plain “true” to /stop to shutdown your app, GET application/json from /status to see how it is running).

Frankly, I’m surprised nobody invented a standard service control interface for simple things like basic control commands. At work we used CORBA and registered in a naming service and then had to deal with Java/C++ ORB connection issues and it seemed like tons of code for something that should be simple.

TR;DR: Consider Node.js with an app framework that serves JSON

Might seem daunting to learn something new, but I chatted with a 10-year Java programmer at a MeetUp last month, & he said it took him 2 days to learn Node from scratch & had a working test server that gave him JSON data his Java clients. He was amazed; he confessed in Java it would take him 1-2 weeks in Java to do the same. Some interesting tutorials & overviews:

  • http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/
  • http://blog.ponyfoo.com/2013/07/12/teach-yourself-nodejs-in-10-steps

(BTW; I am NOT trying to start a Node vs Java war; Java is very good. Simply passing along another idea from another Java programmer; pick what suits you.)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Generic service control interface

I need an interface to a back-end service, mostly for control commands (stop, status, cancel, reload config). The service might be in Python, Perl, Java, or whatever, and runs continuously. The interface will let me send infrequent commands to the running process.

A signal handler can tell a process to stop, and USR1 and USR2 signals let it do two more things. Tomcat sets up a special listener on a fixed port number to get it to shutdown, perhaps due to limitations of Java signal handling.

But I’d like it to respond, not just react. And I’d like to use this for a service written in any language on any platform. I’m hoping to avoid middleware or databases to communicate, since it’s a simply request/response (Q: “how are you?” / A: “I have been running for 3 hours at peak efficiency”).

I glanced at these but they seem like overkill for a simple control interface:

  • dBus – general interprocess message bus
  • UPnP – device communciation
  • Avahi – DNS queries to find services
  • Hadoop YARN – Distributes work across a network, parallel processing

Each seem compelling, but they feel heavy weight or else require special software to be installed ahead of time, or aren’t for every language or every platform.

If I wrote my own, I could write a single-threaded TCP listener with JSON requests/responses. That seems about as lightweight and universal as you can get, and is small enough for a “hello world” service, and big enough for speaking to any service. JSON over TCP would be very command-line friendly (curl or netcat), and therefore easily scriptable. Lots of languages already have a JSON library (C++, Java, etc), in any platform.

A harder approach is adding HTTP semantics to the JSON request/response so you could browse to your application or use curl to control it. But embedding HTTP seems like a lot of space and complexity when it will only support a few resources (PUT text/plain “true” to /stop to shutdown your app, GET application/json from /status to see how it is running).

Frankly, I’m surprised nobody invented a standard service control interface for simple things like basic control commands. At work we used CORBA and registered in a naming service and then had to deal with Java/C++ ORB connection issues and it seemed like tons of code for something that should be simple.

TR;DR: Consider Node.js with an app framework that serves JSON

Might seem daunting to learn something new, but I chatted with a 10-year Java programmer at a MeetUp last month, & he said it took him 2 days to learn Node from scratch & had a working test server that gave him JSON data his Java clients. He was amazed; he confessed in Java it would take him 1-2 weeks in Java to do the same. Some interesting tutorials & overviews:

  • http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/
  • http://blog.ponyfoo.com/2013/07/12/teach-yourself-nodejs-in-10-steps

(BTW; I am NOT trying to start a Node vs Java war; Java is very good. Simply passing along another idea from another Java programmer; pick what suits you.)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Generic service control interface

I need an interface to a back-end service, mostly for control commands (stop, status, cancel, reload config). The service might be in Python, Perl, Java, or whatever, and runs continuously. The interface will let me send infrequent commands to the running process.

A signal handler can tell a process to stop, and USR1 and USR2 signals let it do two more things. Tomcat sets up a special listener on a fixed port number to get it to shutdown, perhaps due to limitations of Java signal handling.

But I’d like it to respond, not just react. And I’d like to use this for a service written in any language on any platform. I’m hoping to avoid middleware or databases to communicate, since it’s a simply request/response (Q: “how are you?” / A: “I have been running for 3 hours at peak efficiency”).

I glanced at these but they seem like overkill for a simple control interface:

  • dBus – general interprocess message bus
  • UPnP – device communciation
  • Avahi – DNS queries to find services
  • Hadoop YARN – Distributes work across a network, parallel processing

Each seem compelling, but they feel heavy weight or else require special software to be installed ahead of time, or aren’t for every language or every platform.

If I wrote my own, I could write a single-threaded TCP listener with JSON requests/responses. That seems about as lightweight and universal as you can get, and is small enough for a “hello world” service, and big enough for speaking to any service. JSON over TCP would be very command-line friendly (curl or netcat), and therefore easily scriptable. Lots of languages already have a JSON library (C++, Java, etc), in any platform.

A harder approach is adding HTTP semantics to the JSON request/response so you could browse to your application or use curl to control it. But embedding HTTP seems like a lot of space and complexity when it will only support a few resources (PUT text/plain “true” to /stop to shutdown your app, GET application/json from /status to see how it is running).

Frankly, I’m surprised nobody invented a standard service control interface for simple things like basic control commands. At work we used CORBA and registered in a naming service and then had to deal with Java/C++ ORB connection issues and it seemed like tons of code for something that should be simple.

TR;DR: Consider Node.js with an app framework that serves JSON

Might seem daunting to learn something new, but I chatted with a 10-year Java programmer at a MeetUp last month, & he said it took him 2 days to learn Node from scratch & had a working test server that gave him JSON data his Java clients. He was amazed; he confessed in Java it would take him 1-2 weeks in Java to do the same. Some interesting tutorials & overviews:

  • http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/
  • http://blog.ponyfoo.com/2013/07/12/teach-yourself-nodejs-in-10-steps

(BTW; I am NOT trying to start a Node vs Java war; Java is very good. Simply passing along another idea from another Java programmer; pick what suits you.)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật