dbus Digest, Vol 157, Issue 8, DBUS - how to handle muliple bus-message in parallel

dtdang ddt.fet.hut at gmail.com
Wed Aug 22 06:09:14 UTC 2018


Hi Lawrence & Simon,

Thanks for your advice.
For now, I am using direct API from libdbus and tried to handle upcoming
messages at the same time. FYI, client will use dbus-send to send messages.
Then dbus-daemon will transfer messages to server. In the worst scenario,
client will send two messages in 10 seconds and those messages make impact
on each other. That's why I am stuck in how to handle 2nd message why 1st
message is still being processing. I did create a task purposing for
receiving messages and parsing to handler. But  I still don't know is there
any API/function in libdbus to trigger handler when message is in queue ?

Thanks,

On Tue, Aug 21, 2018 at 9:00 PM, <dbus-request at lists.freedesktop.org> wrote:

> Send dbus mailing list submissions to
>         dbus at lists.freedesktop.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.freedesktop.org/mailman/listinfo/dbus
> or, via email, send a message with subject or body 'help' to
>         dbus-request at lists.freedesktop.org
>
> You can reach the person managing the list at
>         dbus-owner at lists.freedesktop.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of dbus digest..."
>
>
> Today's Topics:
>
>    1. Not able to access system device from session service
>       (deepan muthusamy)
>    2. Re: Not able to access system device from session service
>       (Simon McVittie)
>    3. Re: DBUS - how to handle muliple bus-message in parallel
>       (Lawrence D'Oliveiro)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 20 Aug 2018 19:22:09 +0530
> From: deepan muthusamy <deepan.m2903 at gmail.com>
> To: Systemd <systemd-devel at lists.freedesktop.org>,
>         dbus at lists.freedesktop.org
> Subject: Not able to access system device from session service
> Message-ID:
>         <CAPNtGhXia_SSw1FRLuh2DFC=DgJg8i2JUw1D49cS=2jYenR5Lg@
> mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I started one application as system service in /etc/systemd/system by
> giving command "systemctl  start mysystem.service".
> I have one more application which i have to start as session service in
> etc/systemd/user by giving command "systemctl --user start
> mysession.service".
>
> My session.service  has dependency on mysystem.service, so I mentioned in
> Requires and After command in session.service.
>
> But when iam trying to session.service it is showing "mysystem.service" not
> found. Can anyone help me with this?
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <https://lists.freedesktop.org/archives/dbus/attachments/
> 20180820/41e5b22f/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 20 Aug 2018 18:40:39 +0100
> From: Simon McVittie <smcv at collabora.com>
> To: dbus at lists.freedesktop.org
> Subject: Re: Not able to access system device from session service
> Message-ID: <20180820174039.GA23379 at archetype.pseudorandom.co.uk>
> Content-Type: text/plain; charset=iso-8859-1
>
> On Mon, 20 Aug 2018 at 19:22:09 +0530, deepan muthusamy wrote:
> > My session.service  has dependency on mysystem.service, so I mentioned in
> > Requires and After command in session.service.
>
> This is really a fact about systemd, not about D-Bus, but you can't do
> that. The Requires, After etc. fields in systemd system services refer to
> other system services. The Requires, After etc. fields in user services
> refer to other user services. There is no way to make a user service
> depend on a system service.
>
> However, you probably don't need to do that anyway. If you set up
> your system service to be "activatable", then it can be started by
> dbus-daemon on-demand the first time it receives a message from one of
> its clients (in your case that's your user/session service). ModemManager
> (org.freedesktop.ModemManager1) is a good example of an activatable
> system service that works like this.
>
> Here's how that looks:
>
> /usr/share/dbus-1/system-services/com.example.YourService.service:
>
>     [D-BUS Service]
>     Name=com.example.YourService
>     Exec=...
>     User=...
>     SystemdService=dbus-com.example.YourService.service
>
> /lib/systemd/system/your-service.service:
>
>     [Unit]
>     ...
>
>     [Service]
>     ...
>
>     [Install]
>     WantedBy=...
>     Alias=dbus-com.example.YourService.service
>
> Replace "..." with whatever is most appropriate for your service,
> replace com.example.YourService (in both filenames and content) with
> your service's well-known D-Bus bus name (use a domain name that you or
> your company owns), and replace the filename your-service.service with
> whatever short name is most appropriate for your service.
>
> In the systemd service, you'll probably want to use Type=dbus and
> BusName=com.example.YourService. That means systemd will only think your
> service is ready for use when it has requested and obtained its well-known
> bus name com.example.YourService.
>
> The systemd [Service] ExecStart should probably be very similar to the
> D-Bus Exec.
>
> Similarly, the User should probably be the same for both. In the systemd
> service file the default is root, but in the D-Bus service file there
> is no default and you must always specify a User (even if it's root,
> as it is for ModemManager).
>
>     smcv
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 21 Aug 2018 10:08:34 +1200
> From: Lawrence D'Oliveiro <ldo at geek-central.gen.nz>
> To: dbus at lists.freedesktop.org
> Subject: Re: DBUS - how to handle muliple bus-message in parallel
> Message-ID: <20180821100834.19927de3 at theon.geek-central.gen.nz>
> Content-Type: text/plain; charset=US-ASCII
>
> On Mon, 20 Aug 2018 20:10:49 +0900, dtdang wrote:
>
> > Currently, I am trying to create a server API to
> > handle multiple dbus-message in parallel.
>
> When you receive a message, it is up to you to construct and return the
> reply at some point with
> dbus_message_new/dbus_message_new_method_return. To avoid holding up
> the dispatching of subsequent messages in the meantime, you need to do
> your actual message processing on a separate thread.
>
> However, for the sake of your own sanity (and that of libdbus as well),
> it is probably best to ensure that all libdbus calls happen on a single
> thread.
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> dbus mailing list
> dbus at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dbus
>
>
> ------------------------------
>
> End of dbus Digest, Vol 157, Issue 8
> ************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20180822/26756b11/attachment.html>


More information about the dbus mailing list