[
https://issues.apache.org/jira/browse/DISPATCH-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16665391#comment-16665391
]
ASF GitHub Bot commented on DISPATCH-1150:
------------------------------------------
Github user ted-ross commented on a diff in the pull request:
https://github.com/apache/qpid-dispatch/pull/394#discussion_r228591596
--- Diff: src/router_core/core_client_api.h ---
@@ -0,0 +1,165 @@
+#ifndef qd_router_core_client_api_h
+#define qd_router_core_client_api_h 1
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//
+// A simple request/response client messaging API using core terminated
links
+//
+
+#include "router_core_private.h"
+
+
+typedef struct qdrc_client_t qdrc_client_t;
+
+
+//
+// client application callbacks
+//
+
+
+/**
+ * Client links have changed state
+ *
+ * @param core
+ * @param client - core client returned by qdrc_client_CT()
+ * @param user_context - as passed to qdrc_client_CT()
+ * @param active - true if both links are opened, else false
+ */
+typedef void (*qdrc_client_on_state_CT_t)(qdr_core_t *core,
+ qdrc_client_t *client,
+ uintptr_t user_context,
+ bool active);
+
+
+/**
+ * Credit has become available for sending messages
+ *
+ * @param core
+ * @param client - core client returned by qdrc_client_CT()
+ * @param user_context - as passed to qdrc_client_CT()
+ * @param available_credit - current credit allocation
+ * @param drain - if true client must consume all credit
+ */
+typedef void (*qdrc_client_on_flow_CT_t)(qdr_core_t *core,
+ qdrc_client_t *client,
+ uintptr_t user_context,
+ int available_credit,
+ bool drain);
+
+/**
+ * Final disposition received for sent message
+ *
+ * @param core
+ * @param client - core client returned by qdrc_client_CT()
+ * @param user_context - as passed to qdrc_client_CT()
+ * @param request_context - as passed to qdrc_client_request_CT()
+ * @param disposition - for the associated sent message
+ */
+typedef void (*qdrc_client_on_ack_CT_t)(qdr_core_t *core,
+ qdrc_client_t *client,
+ uintptr_t user_context,
+ uintptr_t request_context,
+ uint64_t disposition);
+
+/**
+ * A reply message has arrived for a given request
+ *
+ * @param core
+ * @param client - core client returned by qdrc_client_CT()
+ * @param user_context - as passed to qdrc_client_CT()
+ * @param app_properties - application properties header from reply.
+ * Ownership is handed off to this callback - user must free the
+ * iterator when done.
+ * @param body - message body. Ownership is handed off to this callback
+ * - user must free the iterator when done.
+ * @return final disposition for the received reply message
+ */
+typedef uint64_t (*qdrc_client_on_reply_CT_t)(qdr_core_t *core,
+ qdrc_client_t *client,
+ uintptr_t user_context,
+ uintptr_t request_context,
+ qd_iterator_t
*app_properties,
+ qd_iterator_t *body);
+
+
+typedef void (*qdrc_client_request_done_CT_t)(qdr_core_t *core,
+ qdrc_client_t *client,
+ uintptr_t user_context,
+ uintptr_t request_context,
+ const char *error);
+
+
+/**
+ * Create a request/response client
+ *
+ * @param core
+ * @param conn - connection over which links will be created.
+ * @param target - for messages sent by this client.
+ * @param credit_window - for receiver link (credit loop)
+ * @param user_context - context that will be passed to callbacks
+ * @param on_state_cb - callback when link state changes
+ * @param on_flow_cb - callback when sender credit is updated.
+ * @return a new core client
+ */
+qdrc_client_t *qdrc_client_CT(qdr_core_t *core,
+ qdr_connection_t *conn,
+ qdr_terminus_t *target,
+ int credit_window,
+ uintptr_t user_context,
+ qdrc_client_on_state_CT_t on_state_cb,
+ qdrc_client_on_flow_CT_t on_flow_cb);
+
+
+/**
+ * Free a request/response client
+ *
+ * @param client - as returned by qdrc_client_CT()
+ */
+void qdrc_client_free_CT(qdrc_client_t *client);
+
+
+/**
+ * Send a request message
+ *
+ * @param client - as returned by qdrc_client_CT()
+ * @param request_context - context for this request that will be passed to
+ * callbacks
+
+ * @param app_properties - the application properties for the sent message.
+ * Ownership is transferred to this call - the caller must not
reference the
+ * composed field on return.
+
+ * @param body - the message body for the sent message. Ownership is
transferred
+ * to this call - the caller must not reference the composed field
on return.
+
+ * @param on_reply_cb - (optional) invoked when reply message arrives
+ * @param on_ack_cb - (optional) invoked when sent message disposition is
set
+ * @param done_cb - (optional) called once request is done (for cleanup)
+ * @return zero on success.
+ */
+int qdrc_client_request_CT(qdrc_client_t *client,
+ uintptr_t request_context,
--- End diff --
Why is the context not a void* ?
> A request/response message client API for core
> ----------------------------------------------
>
> Key: DISPATCH-1150
> URL: https://issues.apache.org/jira/browse/DISPATCH-1150
> Project: Qpid Dispatch
> Issue Type: New Feature
> Reporter: Ken Giusti
> Assignee: Ken Giusti
> Priority: Major
>
> Add an internal API to the core thread that supports a request/response
> message pattern. It allows the core to send request messages and receive
> responses to an external service.
> This will be used by the edge router to communicate with the management agent
> on the interior router.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]