dxFeed Graal Native SDK 3.15.0
Loading...
Searching...
No Matches
dxfg_message_t Struct Reference

The message event: a notification with an application-specific attachment. More...

#include <dxfg_events.h>

Data Fields

dxfg_event_type_t event_type
const char * event_symbol
int64_t event_time
void * attachment

Detailed Description

The message event: a notification with an application-specific attachment.

It is neither a lasting nor an indexed event: messages are never conflated, its clazz is DXFG_EVENT_MESSAGE.

Javadoc

The attachment (the same for dxfg_configuration_t) is a UTF-8 null-terminated string (const char *, declared as void *) or NULL when there is no attachment:

  • Java -> C: a String attachment is passed as is, the other objects are passed as their string representation (toString()), no attachment is NULL. An attachment that Java cannot deserialize (e.g. its class is not registered for the native image) is NULL too, the SDK logs a warning then.
  • C -> Java: the attachment becomes a String, NULL is no attachment.

So a non-string attachment loses its type when it passes through C: if the event is published back (or forwarded to another endpoint), the Java receivers get the string instead of the original object.

The C API does not support arbitrary Java attachments: C can neither create nor read them. For a string payload prefer dxfg_text_message_t and dxfg_text_configuration_t (TextMessage, TextConfiguration): their text is a plain string that passes both ways without loss.

Memory:

  • The events that the SDK gives to the caller (to a listener, from dxfg_DXFeed_getLastEvent(), a promise, etc.) own their strings: the SDK frees them with the event (after the listener returns, or with dxfg_EventType_release() and dxfg_CList_EventType_release()). Copy the attachment to keep it longer.
  • The events that the caller allocates itself and passes to the SDK (dxfg_DXPublisher_publishEvents(), etc.) are only read: the SDK copies the attachment during the call, the caller allocates and frees it.
  • dxfg_EventType_release() of an event created by dxfg_EventType_new() frees its strings with the SDK's allocator. If the caller sets the attachment of such an event to its own string, it resets the attachment to NULL before the release and frees the string itself (the allocators of the caller and of the SDK may differ, e.g. on Windows).

Field Documentation

◆ attachment

void* dxfg_message_t::attachment

The attachment: a UTF-8 null-terminated string (const char *) or NULL, see dxfg_message_t.

◆ event_symbol

const char* dxfg_message_t::event_symbol

The symbol of the event (a UTF-8 null-terminated string) that belongs to the event and is freed with it.

◆ event_time

int64_t dxfg_message_t::event_time

The time when the event was created, in milliseconds since the Unix epoch (UTC), or 0 if not available.

◆ event_type

dxfg_event_type_t dxfg_message_t::event_type

The base structure: the fields of dxfg_event_type_t.


The documentation for this struct was generated from the following file: