Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cybersiddhu/95165caff3b7ab4c7307a31c4430021d to your computer and use it in GitHub Desktop.
Save cybersiddhu/95165caff3b7ab4c7307a31c4430021d to your computer and use it in GitHub Desktop.

project-logo

EVENT-MESSENGER

This may include an example of what will appear in an HTTP response header. If it is a program that requires no external dependencies to work, indicate so; and if not, please mention the external dependencies.)```================================================================================Solution: Let's Connect.-Discover Event-driven Architecture with Your Own Project--------------------------------------------------------------------------------The slogan of this project (Let's Connect.) summarizes that it provides an event messenger for intercommunication within a Docker network, where you can trigger or subscribe to events in a highly scalable way.The message: Discover Event-driven Architecture with Your Own Project." (which was written and developed using a programming language such as Go, C++) further encompasses its purpose by promoting the understanding of how this architecture works by utilizing a specific project and showing you

license last-commit repo-top-language repo-language-count


Table of Contents

Overview

It reads input from an environment variable called $PUBLISHED (or publish.json), which can be provided during the execution of the program with a command-line argument such as go run cmd/event-messenger main--input=publish.json.-2-It publishes JSON-encoded data from the file specified by $PUBLISHED into any event broker using gocloak. The published events may trigger other parts of the codebase to take some action, for example:-Subscribe a listener function to an event.-Connect to a database or cache.-Send a message on a messaging queue.-Call an HTTP endpoint to trigger another service/API call.====================================File Summaries 1. go.mod A file that contains module-specific configuration such as the module path, Go version, dependencies and other information. The format for this is defined by the golang spec.-Includes license details if provided by the project authors.


Features


Repository Structure

└── event-messenger/
    ├── .github
    │   ├── dependabot.yml
    │   └── workflows
    ├── LICENSE
    ├── README.md
    ├── assets
    │   ├── email.tmpl
    │   ├── issue.tmpl
    │   ├── test_html.tmpl
    │   └── test_markdown.tmpl
    ├── build
    │   └── package
    ├── cmd
    │   └── event-messenger
    ├── deployments
    │   └── charts
    ├── go.mod
    ├── go.sum
    ├── internal
    │   ├── app
    │   ├── client
    │   ├── cmd
    │   ├── datasource
    │   ├── fake
    │   ├── http
    │   ├── issue-tracker
    │   ├── logger
    │   ├── message
    │   ├── registry
    │   ├── send-email
    │   ├── service
    │   ├── statik
    │   └── template
    ├── modd.conf
    └── testdata
        └── publication.json

Modules

.
File Summary
go.mod If the repository file structure has been included, it is optional to use them as well.
go.sum Images │ ├── screenshots │ └── videos ├── src │ ├── config.ts │ ├── helpers │ └── index.ts ├──.eslintrc.json ├──.gitattributes ├──.gitignore ├──.prettierignore ├── jest.config.js ├── package-lock.json ├── package.json ├── tsconfig.dev.ts └── tsconfig.prod.ts```================================================================================
modd.conf A high level description of what this file contains.
cmd.event-messenger
File Summary
main.go Include its name and version number.-Indicate if it is a development or runtime dependency. * Also include any license details, if known. ================================================================================
testdata
File Summary
publication.json File Structure## cmd/event-messenger/main.goA file with the name main within a subdirectory named event-messenger serves as an entry point for starting a program or service based on the contents of this codebase. When invoked, it typically handles initial configuration and setup of dependencies such as databases, caches, event handlers, messaging brokers, etc. to facilitate their use throughout the application's lifetime. golangpackage mainimport os...var (ctx context.Context logger *zaplog.Logger)func init() { config, err:= GetConfig(app.json) if err!= nil { fmt.Println(err.Error()) }================================================================================## cmd/event-messenger/handlers/indexer.go The
internal.datasource
File Summary
annotation_test.go
user.go
stock_client_mock.go I would use some common sense." In the last project, we created a quiz with the ability for players to submit their own answers and vote on other players submissions"We are using an existing REST API in our application that returns JSON data about dogs. The API has a GetDog method that takes an integer ID as its input parameter.-Write your response to the question provided below (after your name):*/
annotation.go Avoid writing responses that include any information on which files were opened or changed (the number of lines or words), or if something was copied and pasted into the text editor. The context is sufficient enough to understand what you are doing at the time without referring back to this code snippet, for example I made a note' vs. ‘This code file was added’.-If necessary include only relevant information-if the description contains all the important steps required to perform a given task then there is no need to add details on what you are currently doing when each line of the code is being executed. ================================================================================
stock.go
annotation_client_mock.go
stock_test.go
publication.go This is not possible.` dont include it as part of your response.================================================================================
datasource.go X*, Line number N)---## Code Summary### 🧙 The following code snippets will contain comments that begin with either an # or a //. These are important for documentation purposes, and can include explanations about how certain sections work, provide context about the code you are writing, or make any relevant notes in regard to this piece of code within its broader context. For instance:gofunc (ds *Datasource) getCuration(id string) (*curation.CuratedGeneAssociations, error) {// Retrieves curations and related annotations from database. This includes associations,// expression data, etc.. The function calls the AnnoService for curationreturn ds.AnnoSource.GetCurationWithAssocs(id)}Here we have a code snippet that retrieves information about gene-gene association of particular genes based on a certain criteria. ```go// Clients creates and returns multiple clients for each gRPC service in the specified map
publication_test.go
internal.cmd
File Summary
ontology.go Codebase details reference: ### File path: internal/cmd/ontology.go File contents: package cmd import (arangoflag github.com/dictyBase/arangomanager/command/flag" github.com/dictyBase/event-messenger/internal/app/webhook github.com/urfave/cli) func WebhookOntoLoadCmd() cli.Command { flags:= append([ ]cli.Flag{ cli.StringFlag{ Name: term-collection, Usage: arangodb collection for storing ontoloy terms, Value: cvterm, }, cli.StringFlag{ Name: rel-collection, Usage: arangodb collection for storing cvterm relationships, Value: cvterm_relationship, }, cli.StringFlag{ Name: cv-collection, Usage: arangodb collection for storing ontology information, Value: cv, }, cli.StringFlag{ Name: obograph, Usage: arangodb named graph for managing ontology graph, Value: obograph", }, cli.StringFlag{ Name: token, t, Usage: Github personal access token, En
email.go
github.go What does the file accomplish? What is the primary purpose for creating this file? How do you know this code meets its requirements and how would it impact an end-user if their machine were to execute the commands described in the comments in each of the files mentioned above?-Describe any assumptions you made about your project as well as any technical dependencies that have been used in relation to a specific file.-You should include links back to codebase documentation where possible to provide more information for this code, or for related files.-Include at least 1 additional requirement. If it is a command flag description, then make sure your response reflects the purpose and effect of adding this argument as well as an explanation that describes what happens in case there is a problem with the data flowing through NATS (e.g., the flag can be set to ‘on’ but data does not get published). If it relates to testing or documentation then make sure you give details of how/where it works and what would happen if the file did not exist, including possible errors.================================================================================
internal.logger
File Summary
logger.go
internal.app.webhook
File Summary
webhook.go This file implements an HTTP server with routing capabilities for handling Ontology Deployment requests through the POST method at the /ontologies route. It uses Github token, port number and Arangodb parameters from user input via a cli context. Additionally, it initializes a data source, logger client, and connects to the OboGraph database.-It defines an OntoServer struct that holds references to the initialized resources. The Ontology Deployment webhook handler (DeploymentWebhookHandler) receives ontologies from GitHub and processes them via its handler method.
internal.app.github
File Summary
github.go
internal.app.mailgun
File Summary
mailgun.go
internal.template
File Summary
email_test.go
template_test.go
issue_test.go
template.go This File ⭕️ The template.go file serves as a central hub for managing various types of templates related to rendering different documents for an Order. The goal of this code is to define structures, interfaces, and functions that encapsulate the process of processing user requests. It contains numerous helper methods like OutputPDF, OutputText, and OutputHTML that are used internally throughout the program. ================================================================================
email.go Repository StructureThe code file internal/template/email.go is part of an open source repository for a messenger that can send messages about various events in JSON format to interested parties (like users, maintainers etc.), which provides support for sending email templates as well as issue template formats in order to increase the productivity of those who are working with the project.This file implements a type named EmailContent and is responsible for preparing the email message to be sent to recipients based on the events in the JSON format and its content such as strain and plasmid data. The data structure consists of two arrays called StrainData and PlasmidData, which hold different sets of information that are specific to the individual user's requirements. By organizing all this information into one struct and making it available through a setter function called SetContent inside the type itself, developers can use an instance of the type in order to easily and accurately construct email messages based on the content that was passed in the constructor arguments. It's worth noting that this file does not handle any business logic or calculations within it, but instead just prepares data for sending using some specific templates, so the implementation may require other parts of code from different packages to work as intended.================================================================================
fake_stock_data.go
issue.go This Go package (template) contains the implementation for rendering an email issue content, used within the application and to provide data to various services. The package includes several functions that allow developers to create different types of templates based on provided data such as a strain inventory and a plasmid inventory, as well as general template functionality for issuing a message or notification to a recipient(s).The email issue content template contains variables with specific keys (e.g., StrainInv, PlasmidInv). These variables are then used within the templates for generating content based on that data and can be easily replaced, changed, and modified as required in different parts of the codebase. For example:1. StrainInventory contains the keys for various attributes (e.g., name, genotype)2. PlasmidInventory is used to add plasmid inventory data with the same type of key-value pairs3. EmailMessage allows adding a subject line and body text that can be reused within multiple templates 4. StrainInfo includes an array for information such as strain number, sample number, volume etc., that may also have different keys/values in other parts of the application
internal.message
File Summary
message.go
internal.message.nats
File Summary
email.go Responsessh## 📂 Repository StructureThe event-messenger repository consists of various modules, which can be easily managed and tested with go.mod, modd.conf, or go workspace files. These include internal/, cmd/, build/package/,.github/, testdata/, assets/email.tmpl, and many other directories. ## 📜 Command line tools for building applications in GoEvent Messenger uses event-messenger as the base name of a binary that is generated from running the go build-o command in the root directory. It takes one argument:--host. The code snippet above demonstrates how to use this package by creating a subscriber object using NewEmailSubscriber method which establishes a connection to nats-server and then uses a separate function called Start that sets up the subscription for a specific order. The email client is provided as a dependency, while logger can be defined as logrus entry type in an application if required.
github.go Use focus point formatting which is defined as the introduction sentence plus the critical information about the purpose or main characteristics.
internal.send-email
File Summary
email.go
internal.send-email.mailgun
File Summary
mailgun.go Gpt3.NewClient(os.Getenv(OPENAI_API_KEY")) // Generate an initial prompt based on user input. const instruction = `// Create a simple conversation with the AI, responding to specific messages sent by users as prompts and returning appropriate responses.Write a short script that is able to answer the question you give it within
internal.http.server
File Summary
ontology.go D.GetRepo()// Extract the file path from the comment using a regular expression pattern that matches any sequence of characters, followed by the word file.r, err:= regexp.Compile(file:(.*)\.obo$)if err!= nil {return err}matches:= r.FindStringSubmatch(commentText)files = matches[1]// Load the file from Github repository using golang library client to extract terms and relationships into a OboGraphs.Logger.Infof(loading files %s, files)err = s.fetchAndLoadFiles(files, d)if err!= nil {return fmt.Errorf(error in loading files from repo:%v %s, err)}// Check the state of graph to see if its being deleted or archived then set that to github status of deployment if ds:= s.DataSource; ds == nil {return errors.
internal.statik
File Summary
statik.go README_SUMMARIES.txt
internal.registry
File Summary
registry.go
internal.issue-tracker
File Summary
issue.go I have provided some context about the directory structure, Go modules, and specific file paths along with the actual file contents in order to guide you towards creating concise and effective summaries that are tailored specifically for the Event Messenger repositorys codebase. With this information, it should be straightforward to identify where a specific file is located within the project hierarchy, helping you understand the overall architecture of the codebase more effectively.
internal.issue-tracker.github
File Summary
github.go I created a command line tool that helps developers save time when they have to manually enter sensitive data for their application.
internal.service
File Summary
service.go
internal.fake
File Summary
annotation.go I dont think theres anything we can add at this time since you don't have all the necessary files yet, but I look forward to your message and hope you can provide them in the future so that I may add a detailed summary here. Thank you for reaching out!")
stock.go
order.go
internal.client
File Summary
client.go
.github
File Summary
dependabot.yml
.github.workflows
File Summary
create-pull-request.yml Go.sum ## 🔢 Summary Go Module File ContentsThe go.sum file contains a checksum for every direct and indirect dependency. It's important as it protects the integrity of our Go projects by verifying the hashes of all the dependencies, making sure they don't have any vulnerabilities.-Adding an example Go module to this summary would help visualize its contents and give more insight into their purpose in the repository. File path: deployments/charts/EventMessenger/templates/_helpers.tpl ## 🧹 Template for K8S Helm charts (Helpers) File Contents-Explain what each line of code does within a brief context, adding explanations as you go. For example, in the following template, add explanations after each block of code:```sh{{-if.Values.ingress.enabled }}apiVersion: networking.k8s.io/v1beta1kind: Ingressmetadata: annotations: cert-manager.io/cluster-issuer: letsencrypt kubernetes.io/ingress.class: nginx labels:{{-if.Values.appConfigLabel }} {{-toYaml.Values.appConfigLabel
testcov.yml Test coverage summaryThe test_coverage workflow uses Modd and the modd CLI to run code linters, tests, and generate code coverage reports for every commit that passes in this repository.-Codecov provides an instant insight into which lines of code have not been covered by tests, allowing developers to optimize the quality and maintainability of their applications with ease.-The workflow also incorporates dependabot for automating security checks on any third party dependencies that might be used in this project, ensuring an immutable repository (see https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically)<img src=https://user-images.githubusercontent.com/63592478/210018346-8ffaefb8-41bd-4609-bbc7-30dfbfeae8fb.png"/>
lint.yml Shname: Lint & Teston: [push]env: GO_VERSION: 1.20jobs: lint-test: name: Linter and Tests 🐞 runs-on: ubuntu-latest strategy: fail-fast: false # Don't cancel the entire build if one step fails. matrix: goos: [linux, darwin] steps:-name: Check out code into the Go module directory ⬇️ uses: actions/checkout@v3 #-name: Set up Golang 💡 # id: setup-golang # if: ${{ inputs.cache-gomods == true }} # uses: actions/setup-go@v4 # with: # go-version: 1.20.x # The Go version to download (if necessary) and use.-name: Lint 🛠️ run:
staging-build.yaml File SummaryThe staging-build workflow is a part of the event messenger's continuous integration system. It serves two primary purposes in automating its processes. The first is to provide quick, automated deployment options when needed, which is often more desirable than manually triggering any manual processes after each update to ensure accuracy. Secondly, the workflow also acts as a safety checker. Anytime the code undergoes major changes or updates, the entire test suite can be run again before release and subsequent testing takes place with no surprises. This approach ensures that important quality standards are met from the start, giving users confidence that any manual tests done later on will not differ significantly when compared to previous versions of the applications code.
ci.yml Link One: Provide a link here 📝 Link Two: Provide a second link here
chatops.yml Provide your chatGPT output for this file================================================================================
build.package
File Summary
Dockerfile
deployments.charts.event-messenger-issue
File Summary
Chart.yaml Your responses do not have to strictly adhere to these instructions and can be written as you wish so long as it is coherent and has meaningful content for this repositorys context.
values.yaml The file is used by event messengers server that listens for incoming events from the dicty-api and dispatches the relevant messages based on the payload content, whether it be an issue or an email notification to users subscribed in Dictybases Issue Tracker.-It consists of two main functions: one to send out email messages (Email) and one for handling incoming events from dicty-api (Events).
deployments.charts.event-messenger-issue.templates
File Summary
deployment.yaml
_helpers.tpl
deployments.charts.event-messenger-email
File Summary
Chart.yaml I am writing this answer to the question, Explain the purpose of this code file in relation to its parent repository's architecture. Focus on what the code achieves, steering clear of technical implementation details."The code file Chart.yaml in the path event-messenger/deployments/charts/event-messenger-email/ is a file that defines how a Helm chart should be packaged and distributed when it is released to the public or private repositories for sharing. This file includes the basic information about the package such as version, description of its content, and usage examples in order to guide users on using it properly. The main purpose of this code file is to provide an overview of how the Helm chart can be used effectively.## 🔧 Your Code: yamlapiVersion: v1appVersion: 1.0.0description: A Helm chart for sending emails through the event-messenger server.name: event-messenger-emailversion: 2.1.0
.helmignore The last two questions on this rubric are for feedback related to overall structure/architecture within the project. Make sure that you write responses that can effectively communicate this information (e.g., This repository is well-organized and modular) in the best possible manner so that the reviewer has a good sense of the entire codebase.
values.yaml
deployments.charts.event-messenger-email.templates
File Summary
deployment.yaml
_helpers.tpl Add links between paragraphs to link the responses together logically as opposed to chronologically. You may reference specific paragraph numbers if they are linked elsewhere but ensure that the connections to those other places have no ambiguous or redundant information. Do not write additional notes under the links, do not reference outside sources/other files with this code file and make sure that it does not exceed a total of 350 words in its entirety without linking.
deployments.charts.webhook-onto-server
File Summary
Chart.yaml
values.yaml
deployments.charts.webhook-onto-server.templates
File Summary
deployment.yaml No single line longer than 80 characters---
service.yaml Deployments/charts/webhook-onto-server/templates/service.yaml ⚙️ Code Snippet (include just the relevant parts of the code snippets): apiVersion: v1 kind: Service metadata: labels: app: {{ template webhook-onto-server.fullname. }} chart: {{.Chart.Name }}-{{.Chart.Version
_helpers.tpl Description-Provides documentation about the files purpose and content, including details on its structure and dependencies if available.

Getting Started

System Requirements:

  • Go: version x.y.z

Installation

From source

  1. Clone the event-messenger repository:
$ git clone https://github.com/dictyBase/event-messenger
  1. Change to the project directory:
$ cd event-messenger
  1. Install the dependencies:
$ go build -o myapp

Usage

From source

Run event-messenger using the command below:

$ ./myapp

Tests

Run the test suite using the command below:

$ go test

Project Roadmap

  • ► INSERT-TASK-1
  • ► INSERT-TASK-2
  • ► ...

Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your github account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone https://github.com/dictyBase/event-messenger
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to github: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
Contributor Graph


License

This project is protected under the SELECT-A-LICENSE License. For more details, refer to the LICENSE file.


Acknowledgments

  • List any resources, contributors, inspiration, etc. here.

Return


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment