-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmessaging.go
More file actions
99 lines (88 loc) · 4.21 KB
/
messaging.go
File metadata and controls
99 lines (88 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright The Linux Foundation and each contributor to LFX.
// SPDX-License-Identifier: MIT
// Package constants provides shared constants used throughout the LFX indexer service.
package constants
import "time"
// NATS subject prefixes (preserved from existing)
// These constants define the protocol format for NATS message subjects
const (
IndexPrefix = "lfx.index." // V2 message prefix
FromV1Prefix = "lfx.v1.index." // V1 message prefix
EventSubjectPrefix = "lfx." // Post-indexing domain event prefix: lfx.{object_type}.{action}
)
// BuildEventSubject constructs the NATS subject for a post-indexing domain event.
// Format: lfx.{object_type}.{action} (e.g., "lfx.project.created", "lfx.committee.deleted").
func BuildEventSubject(objectType string, action MessageAction) string {
return EventSubjectPrefix + objectType + "." + string(action)
}
// NATS subjects (professional expansion)
const (
ProjectSubject = IndexPrefix + "project" // V2 project messages
V1ProjectSubject = FromV1Prefix + "project" // V1 project messages
MeetingSubject = IndexPrefix + "meeting" // V2 meeting messages
SubjectIndexing = IndexPrefix + "index" // V2 indexing messages
SubjectV1Indexing = FromV1Prefix + "index" // V1 indexing messages
AllSubjects = IndexPrefix + ">" // All V2 subjects
AllV1Subjects = FromV1Prefix + ">" // All V1 subjects
)
// MessageAction represents the type of indexing operation to perform.
type MessageAction string
const (
// ActionCreate indicates a resource will be created
ActionCreate MessageAction = "create"
// ActionCreated indicates a resource was created
ActionCreated MessageAction = "created"
// ActionUpdate indicates a resource will be updated
ActionUpdate MessageAction = "update"
// ActionUpdated indicates a resource was updated
ActionUpdated MessageAction = "updated"
// ActionDelete indicates a resource will be deleted
ActionDelete MessageAction = "delete"
// ActionDeleted indicates a resource was deleted
ActionDeleted MessageAction = "deleted"
)
// Header constants (centralized)
const (
HeaderXUsername = "x-username" // V1 username header
HeaderXEmail = "x-email" // V1 email header
)
// Object types (centralized)
const (
ObjectTypeProject = "project"
ObjectTypeProjectSettings = "project_settings"
ObjectTypeCommittee = "committee"
ObjectTypeCommitteeSettings = "committee_settings"
ObjectTypeCommitteeMember = "committee_member"
ObjectTypeMeeting = "meeting"
ObjectTypeMeetingSettings = "meeting_settings"
ObjectTypeMeetingRegistrant = "meeting_registrant"
ObjectTypeMeetingRSVP = "meeting_rsvp"
ObjectTypeMeetingAttachment = "meeting_attachment"
ObjectTypePastMeeting = "past_meeting"
ObjectTypePastMeetingAttachment = "past_meeting_attachment"
ObjectTypePastMeetingParticipant = "past_meeting_participant"
ObjectTypePastMeetingRecording = "past_meeting_recording"
ObjectTypePastMeetingTranscript = "past_meeting_transcript"
ObjectTypePastMeetingSummary = "past_meeting_summary"
ObjectTypeGroupsIOService = "groupsio_service"
ObjectTypeGroupsIOServiceSettings = "groupsio_service_settings"
ObjectTypeGroupsIOMailingList = "groupsio_mailing_list"
ObjectTypeGroupsIOMailingListSettings = "groupsio_mailing_list_settings"
ObjectTypeGroupsIOMember = "groupsio_member"
// V1 Meeting object types
ObjectTypeV1Meeting = "v1_meeting"
ObjectTypeV1PastMeeting = "v1_past_meeting"
ObjectTypeV1MeetingRegistrant = "v1_meeting_registrant"
ObjectTypeV1MeetingRSVP = "v1_meeting_rsvp"
ObjectTypeV1PastMeetingParticipant = "v1_past_meeting_participant"
ObjectTypeV1PastMeetingRecording = "v1_past_meeting_recording"
ObjectTypeV1PastMeetingTranscript = "v1_past_meeting_transcript"
ObjectTypeV1PastMeetingSummary = "v1_past_meeting_summary"
)
// Message processing constants
const (
DefaultQueue = "lfx.indexer.queue"
RefreshTrue = "true" // OpenSearch refresh parameter
RefreshFalse = "false" // OpenSearch refresh parameter
ReplyTimeout = 5 * time.Second
)