<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Devprime | Documentation – Introduction</title>
    <link>https://docs.Devprime.io/examples/introduction/</link>
    <description>Recent content in Introduction on Devprime | Documentation</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    
	  <atom:link href="https://docs.Devprime.io/examples/introduction/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Examples: Creating the first microservice using MySQL and RabbitMQ</title>
      <link>https://docs.Devprime.io/examples/introduction/creating-the-first-mysql-microservice/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://docs.Devprime.io/examples/introduction/creating-the-first-mysql-microservice/</guid>
      <description>
        
        
        &lt;p&gt;In this example we will enter the name of the new application, the Stream service type as &amp;ldquo;&lt;em&gt;&lt;strong&gt;RabbitMQ&lt;/strong&gt;&lt;/em&gt;&amp;rdquo; for event emitting &amp;ldquo;Event-Driven architecture&amp;rdquo; and the State as &amp;ldquo;&lt;em&gt;&lt;strong&gt;MySQL&lt;/strong&gt;&lt;/em&gt;&amp;rdquo; for data persistence.&lt;/p&gt;
&lt;p&gt;Before starting development it is necessary to &lt;a href=&#34;../docker/&#34;&gt;configure containers in docker with RabbitMQ and MySQL&lt;/a&gt;. Create the &amp;ldquo;orderevents&amp;rdquo; queue in RabbitMQ.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;dp new Order --stream rabbitmq --state mysql&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The Devprime CLI will create a new production-ready microservice. The new applications created receive a complete and functional software architecture foundation allowing them to accelerate software development&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://docs.Devprime.io/images/cli/devprime-cli-dp-new-result-mysql.png&#34; alt=&#34;Devprime mysql microservice&#34;&gt;&lt;/p&gt;
&lt;p&gt;Enter the project folder and follow the next steps.&lt;/p&gt;
&lt;h3 id=&#34;adding-a-business-rule&#34;&gt;Adding a Business Rule&lt;/h3&gt;
&lt;p&gt;The created project is already ready to receive the business rules in the Domain Driven Design (DDD) standard. The code must be written inside the Domain folder. After including it, it is possible to use the &amp;ldquo;dp init&amp;rdquo; accelerator to analyze the domain and create the necessary code for API exposure, further simplifying the development journey, in addition to maintaining the best development practices.&lt;/p&gt;
&lt;p&gt;To facilitate our example, we will use the &amp;ldquo;Order&amp;rdquo; domain using a marketplace service of the Devprime platform. Use the command below and check the result in the Domain src/Core/Domain/Aggregates folder.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;dp marketplace order
dp init
&lt;/code&gt;&lt;/pre&gt;&lt;blockquote&gt;
&lt;p&gt;The new microservice is ready !!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id=&#34;exporting-the-data-structure&#34;&gt;Exporting the Data Structure&lt;/h3&gt;
&lt;p&gt;The Devprime CLI offers a command to export the scripts and you can apply them manually using the MySQL Workbench tool or some DevOps process.&lt;br&gt;
&lt;code&gt;dp export state state1&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;creating-the-database-structure&#34;&gt;Creating the Database Structure&amp;quot;&lt;/h3&gt;
&lt;p&gt;The Devprime CLI offers a command to export and apply the relational database structure as per the example below. It will use the project&amp;rsquo;s credentials.&lt;br&gt;
&lt;code&gt;dp state apply state1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://docs.Devprime.io/images/cli/devprime-cli-dp-apply-state-mysql.png&#34; alt=&#34;Devprime mysql microservice&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;starting-the-order-microservice&#34;&gt;Starting the &amp;ldquo;Order&amp;rdquo; microservice&lt;/h3&gt;
&lt;p&gt;You can run the application using &amp;ldquo;dotnet run&amp;rdquo; or using the script files &amp;ldquo;.\run.ps1&amp;rdquo; if you are using powershell (Windows, Linux, macOS) or &amp;ldquo;./run.sh&amp;rdquo; in bash (Linux and macOS).&lt;br&gt;
&lt;code&gt;chmod +x run.sh&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;When starting the application, it will be possible to follow the log below.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;https://docs.Devprime.io/images/app/devprime-app-start.png&#34; alt=&#34;Devprime mysql microservice&#34;&gt;&lt;/p&gt;
&lt;p&gt;We just completed this journey using Devprime, RabbitMQ, and MySQL.&lt;/p&gt;

      </description>
    </item>
    
  </channel>
</rss>
