Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Core/Resgrid.Model/Helpers/SerializerHelper.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using ProtoBuf;
using ProtoBuf;
using Resgrid.Model.Events;
using Resgrid.Model.Identity;
using Resgrid.Model.Queue;

namespace Resgrid.Model.Helpers
{
public static class SerializerHelper
{
public static void WarmUpProtobufSerializer()
{
// Core model types (also serialized into the cache).
Serializer.PrepareSerializer<Department>();
Serializer.PrepareSerializer<Address>();
Serializer.PrepareSerializer<DepartmentMember>();
Expand All @@ -17,6 +20,22 @@ public static void WarmUpProtobufSerializer()
Serializer.PrepareSerializer<PlanLimit>();
Serializer.PrepareSerializer<IdentityUser>();
Serializer.PrepareSerializer<UserProfile>();

// Every payload type published to RabbitMQ (see RabbitOutboundQueueProvider).
// Preparing them here builds the protobuf contract at startup, so a type that is
// missing [ProtoContract] fails fast on boot instead of on the first enqueue.
Serializer.PrepareSerializer<CallQueueItem>();
Serializer.PrepareSerializer<ChatbotMessageQueueItem>();
Serializer.PrepareSerializer<MessageQueueItem>();
Serializer.PrepareSerializer<DistributionListQueueItem>();
Serializer.PrepareSerializer<NotificationItem>();
Serializer.PrepareSerializer<ShiftQueueItem>();
Serializer.PrepareSerializer<WorkflowQueueItem>();
Serializer.PrepareSerializer<CqrsEvent>();
Serializer.PrepareSerializer<AuditEvent>();
Serializer.PrepareSerializer<UnitLocationEvent>();
Serializer.PrepareSerializer<PersonnelLocationEvent>();
Serializer.PrepareSerializer<SecurityRefreshEvent>();
}
}
}
1 change: 1 addition & 0 deletions Core/Resgrid.Model/Queue/ChatbotMessageQueueItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Resgrid.Model.Queue
/// The worker resolves IChatbotIngressService, processes the message, and sends the reply
/// back to <see cref="From"/> via the SMS transport.
/// </summary>
[ProtoContract]
public class ChatbotMessageQueueItem
{
[ProtoMember(1)]
Expand Down
Loading