<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bartosz Pietrzak on Medium]]></title>
        <description><![CDATA[Stories by Bartosz Pietrzak on Medium]]></description>
        <link>https://medium.com/@bartosz.pietrzak1994?source=rss-1ead9ce85bd0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*muONNc99ACxYwkbvoiRUvQ.png</url>
            <title>Stories by Bartosz Pietrzak on Medium</title>
            <link>https://medium.com/@bartosz.pietrzak1994?source=rss-1ead9ce85bd0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 19:48:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bartosz.pietrzak1994/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[It’s very likely you have not got burnt out]]></title>
            <link>https://medium.com/dna-technology/its-very-likely-you-have-not-got-burnt-out-b1031cb7b894?source=rss-1ead9ce85bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1031cb7b894</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[pandemic]]></category>
            <category><![CDATA[soft-skills]]></category>
            <category><![CDATA[self-awareness]]></category>
            <dc:creator><![CDATA[Bartosz Pietrzak]]></dc:creator>
            <pubDate>Tue, 22 Nov 2022 13:07:18 GMT</pubDate>
            <atom:updated>2022-11-23T14:58:33.744Z</atom:updated>
            <content:encoded><![CDATA[<p>Apart from measuring the level of productivity, number of social interactions and wellbeing, post-COVID questionnaires usually address getting burnt out. It does not surprise me at all — a huge majority of companies was not prepared for such a rapid change, what may have resulted in employees feeling lost, bored or not willing to work at all.</p><p>“Being burnt out” sounds pretty definitive, like something that one should react upon immediately. Today I’m going to share some thoughts that I wish I had when I was heading towards this state of mind. If you are feeling the same, you might find some useful guidelines in the paragraphs below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ynZR9wEDn2WR9JbKwPzkA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jannerboy62">Nick Fewings</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>What happened?</strong></h3><p>It all started with a feeling that working days stopped being different from one another. Although it could have resulted from working with the same codebase for a long while, I felt that it was more serious. After a few months of a constant <strong>To Do -&gt; In Progress -&gt; Done</strong> <strong>cycle</strong> I decided to look for a solution.</p><p>First of all, for the past 2 years I’ve seen many developers trying to tackle their boredom and some of them changed their jobs. As refreshing as it may seem, in many cases it turned out to be a short term solution. <strong>After the first couple of weeks filled with excitement the problem would come back oftentimes</strong>. Since stability is an important factor for me, I have not considered giving it a shot. It doesn’t mean that changing jobs won’t work for you. My point is that analysing this issue a bit deeper may pay off.</p><h3><strong>First thoughts</strong></h3><p>After a couple of eye-opening conversations I managed to reach the first milestone. I realised that I was experienced enough to do my job without being surprised as often as I would like to be. I wanted those “a-ha!” moments to come back, <strong>I was used to them finding me, not me finding them.</strong></p><p>There’s something in the IT world that I consider a bit inaccurate — using words like “junior”, “regular” and “senior” to measure someone’s experience or rather time spent being a software developer. I bet that you’ve at least heard of someone hired as a senior engineer who would made basic mistakes or not follow good practices. It’s a bit absurd, isn’t it?</p><h3>Realisation</h3><p>So back then I was a senior software developer “on paper”. Having said that, I started to wonder how could one describe such a skillset? Here’s what I discovered in the last couple of months:</p><p><strong>Senior software developers are able to organise their time efficiently, look for new challenges on their own and develop themselves in what they are good at.</strong></p><p>Let’s break this statement down into 3 points:</p><ol><li><strong>Organise time efficiently</strong><br>The more experienced you are, the more accurate your estimations become. You are more likely to avoid being stressed because of unexpected events. If you organise your time in an efficient way the likelihood of participating in fruitful discussions increases significantly. The same thing applies to developing good habits.</li><li><strong>Look for new challenges on your own<br></strong>Here comes the tricky part. No matter how I felt before — enthusiastic, happy, lazy or tired — new knowledge would keep coming. It made every day special in terms of becoming a better specialist. Now imagine loosing it in the middle of the pandemic. Have I got burnt out? Do I have a forgettable 9 to 5 job now? Should I start doing something different?<br>I was aware of a vast amount of things I could learn but what exactly should I do? Start practicing React, pick up Terraform or maybe focus on my English skills so that I could deliver better presentations? How do I determine what to pick up first and how to find some words of encouragement so that I’m sure that I’m heading towards success?</li><li><strong>Develop myself in what I am good at<br></strong>Here’s what I think — there’s such a huge dose of tech knowledge to absorb that spending your time on something that you don’t enjoy is pointless — that’s how you get burnt out. Let’s find out how one can determine what they are good at.</li></ol><h3>The power of feedback</h3><p>If you want to discover your strengths and weaknesses, do yourself a favour — <strong>give feedback and look for one</strong>. If you’re not getting any — start giving it so this habit comes back to you at some point. It will, I promise.</p><p>It’s worth mentioning that collecting feedback is all about asking accurate questions. If you ask a general question, like:</p><p><strong>“Hey, could you give me feedback?”</strong></p><p>then you are likely to hear something like:</p><p><strong>“I really enjoy working with you”</strong></p><p><strong>Which is kind, of course, but not very helpful.</strong> You’d probably like to find out what you are good at or what you could improve. My advice is to spend some time on making these questions as specific as possible so you get a detailed answer.</p><p><strong>“If you would have to choose a single thing that I should improve, what would it be?”</strong></p><p><strong>“What, in your opinion, is my biggest strength?”</strong></p><h3>A big reveal</h3><p>So, for the past couple of minutes you’ve been reading a blogpost about being a senior software developer but the text is not focused on engineering at all. Or maybe it is since <strong>nowadays it’s about a bit more than coding</strong>?</p><p>Now I know my <strong>motivation crisis was a result of becoming a more and more mature software developer</strong> (with pandemic trauma as a huge catalyst). I haven’t overcome it by either changing my environment, my attitude to work or waiting for the boredom to go away. In my case it was all about learning some missing soft skills. Have it made me a better software engineer? It definitely have.</p><h3>Not burnt out, more aware</h3><p>That’s why you might consider verifying whether your communication skills have not been neglected. Especially in comparison to how much time you spend on learning how to write a better code.</p><p>I know the temptation to focus only on the technology might be huge. However, if you have ever played any RPG you know that mastering a very limited range of skills makes your character <strong>much more liable to unexpected events</strong>.</p><p>Stay safe!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1031cb7b894" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dna-technology/its-very-likely-you-have-not-got-burnt-out-b1031cb7b894">It’s very likely you have not got burnt out</a> was originally published in <a href="https://medium.com/dna-technology">DNA Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Outbox pattern — a quick overview]]></title>
            <link>https://medium.com/dna-technology/outbox-pattern-a-quick-overview-c1c756846d2c?source=rss-1ead9ce85bd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1c756846d2c</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[outbox-pattern]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Bartosz Pietrzak]]></dc:creator>
            <pubDate>Fri, 14 Jan 2022 14:49:18 GMT</pubDate>
            <atom:updated>2022-01-19T10:06:22.822Z</atom:updated>
            <content:encoded><![CDATA[<h3>Outbox pattern — a quick overview</h3><p>Today we’re going to talk about a classic problem that may occur every time one considers building a decoupled system following the event-driven architecture. What should happen if emitting an event is not successful?</p><p>Of course, you could log the event’s body just before sending it. However, what about obfuscated personal data? Well, it could be taken from the database. But what should one do if the database access on production environment is restricted? These kind of questions should not be asked since that kind of problems should have their fairly simple solution — even if it is an event schema mismatch or the message broker being temporarily unavailable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TQrs3Z0JMu9qd4md" /><figcaption>Photo by <a href="https://unsplash.com/@phayes007?utm_source=medium&amp;utm_medium=referral">Paula Hayes</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>Communication in event-driven architecture</strong></h3><p>At first, let’s focus on asynchronous communication. Dividing a project into a couple of microservices can increase teams’ autonomy, shorten the pipelines and come up with smaller, more domain-focused deployments units (although some of these benefits can be also achieved by developing a modular monolith).</p><p>The independence factor can be boosted if the services communicate asynchronously — the fact that service A emitted event Vn+1 does not mean that the message will be lost when service B is not prepared for consuming it. The event will be temporarily skipped and eventually processed once the new version of service B is deployed.</p><p>Here’s how more and more teams achieve independence and event backups while avoiding bottlenecks introduced by synchronous processing at the same time. However, communication or performance problems may occur also between the service itself and the event broker. Here’s where the outbox pattern comes in handy.</p><h3><strong>Outbox pattern</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MP7IlUcGxebaN43NEvhC2w.png" /></figure><p>The pattern consists of a few principles:</p><ol><li>The event publisher guarantees that the event will be sent to the event broker.</li><li>After processing an event or http request, the service stores the event intent in the database. You can find an example migration script in the snippet below.</li><li>A separate transaction periodically looks for the events that have not been sent and tries to emit them. Once it succeeds, the event status is updated.</li></ol><pre>CREATE TABLE `outbox_event_intent` (<br>`id` bigint NOT NULL AUTO_INCREMENT,<br>`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,<br>`modified_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,<br>`version` bigint NOT NULL,<br>`sent_at` TIMESTAMP DEFAULT NULL,<br>`body` LONGTEXT NOT NULL,<br>`status` VARCHAR(255) NOT NULL,<br>`idempotency_key` VARCHAR(255) NOT NULL,<br>`partition_key` VARCHAR(255) NOT NULL,<br>`type_id` VARCHAR(255) NOT NULL,<br>`topic` VARCHAR(255) NOT NULL<br>);</pre><h3>Benefits</h3><p>First of all, it stresses the publisher’s responsibility for sending the events. If for any reason the event does not end up on the broker, one can be 100% sure that the intent is saved provided the service’s client got a response indicating that request was processed successfully.</p><ol><li>Having all of the intents stored with their unique identifiers makes it easy to implement an endpoint for resending any of the events. This identifier in our case is called idempotencyKey and is used by event consumers in order to make sure that every event is process at most once.</li><li>The intents saved in the database do not need to follow event retention policies established on the broker. As a result, the intent storage is also an event back up.</li></ol><h3>Any drawbacks?</h3><ol><li>Saving the intent should be possibly close to the business process. It means that every microservice that applies the outbox pattern is also responsible for storing the intents. As a result, although the main principles introduced by the outbox pattern can be hidden behind a layer of abstraction, writing a bit of boilerplate code seems to be inevitable.</li><li>If sending the event used to be a part of a synchronous process, you might need to redesign it a bit. Why? Well, it may happen that the actions taken after sending the event relies on it being sent. After introducing the outbox pattern, no one knows when exactly will the event end up on the topic. As a result, the actions depending on the event being sent should be moved to a newly created listener that will perform them once it’s on the topic. It might sound tricky, but the diagrams below should make it more clear.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xKwwE2Pr6k8hwvYO43FFcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vVH0MrNJ67xN-l_pSIsdug.png" /></figure><h3><strong>Alternative approach</strong></h3><p>Although introducing the outbox pattern may sound like a great idea, a completely natural behaviour is trying not to repeat yourself not to repeat yourself. As a result, it’s likely that you will consider centralising the solution. Let’s focus on two ideas that would make it possible.</p><ol><li>A centralised database with a predefined schema and a separate service that processes the intents.</li><li>A separate service exposing a REST API that accepts the intents, stores it in its own database and then processes them. Basically it’s about the outbox pattern encapsulated inside of a separate deployment unit.</li></ol><p>Let’s focus on the first one at the beginning. Implementing it would mean that every service that communicates with the event bus would also need to connect to two databases. Well, it seems that we’ve just replaced a bit of boilerplate code with… complexity. The amount of code may differ depending on the programming language and used frameworks but the fact that resolving one problem originates another one in undeniable.</p><p>Also, a huge disadvantage of both approaches is the fact that they violate one of the outbox pattern principles — storing an intent has to happen in the same transaction as other side effects that result in storing new data. Obviously, everything can be achieved by proper distributed transaction management, but again — boilerplate code will be replaced with complexity.</p><h3>Example implementation</h3><p>Having said that, the solution based on coming up with a proper abstraction layer covering the implementation details (entities and database schema) seems to be the safest and the simplest one. Since we all know that talk is cheap, let’s look at the code snippets written in Java.</p><pre>public void save(String topic, String partitionKey, String idempotencyKey, Object event)<br>        throws JsonProcessingException {<br>    <em>log</em>.info(&quot;Saving event intent - topic: {}, partitionKey: {}, idempotencyKey: {}&quot;, topic, partitionKey,<br>            idempotencyKey);<br><br>    outboxRepository.save(EventIntent.<em>builder</em>()<br>            .status(EventStatus.<em>NEW</em>)<br>            .idempotencyKey(idempotencyKey)<br>            .partitionKey(partitionKey)<br>            .typeId(event.getClass().getName())<br>            .body(objectMapper.writeValueAsString(event))<br>            .topic(topic)<br>            .build()<br>    );<br>}</pre><p>Here’s the first part of the process, which is translating the event and its parameters to an event intent that’s eventually stored.</p><pre>public void send() {<br>    <em>log</em>.info(&quot;About to start processing event intents. Number of batches: {}, batch size: {}&quot;, numberOfBatches,<br>            batchSize);<br><br>    IntStream.<em>range</em>(0, numberOfBatches).forEach(i -&gt; {<br>        List&lt;EventIntent&gt; eventIntents = outboxRepository.findBatchForUpdate(batchSize);<br><br>        for (EventIntent intent : eventIntents) {<br>            <em>log</em>.info(&quot;About to send an event with idempotencyKey: {}&quot;, intent.getIdempotencyKey());<br>            try {<br>                kafkaTemplate.send(toProducerRecord(intent)).get(10, TimeUnit.<em>SECONDS</em>);<br>                intent.setStatus(EventStatus.<em>SENT</em>);<br>                intent.setSentAt(ZonedDateTime.<em>now</em>());<br>            } catch (Exception e) {<br>                <em>log</em>.error(&quot;Sending an event with idempotencyKey: {} failed. Exception message: {}&quot;,<br>                        intent.getIdempotencyKey(), e.getMessage());<br>                intent.setStatus(EventStatus.<em>FAILED</em>);<br>            }<br><br>            outboxRepository.save(intent);<br>        }<br>    });<br>}</pre><p>The snippet above contains a function that should be called periodically so that all unsent intents are processed. The processing is divided into batches so that the time interval, batch size and number of batches could be configured for each service separately.</p><p>Both snippets placed above are the part of the same KafkaOutbox class, cover the main Outbox Pattern principles and are the part of the common library used in every service that communicates with the event broker (Kafka in this specific scenario). Keep in mind that because of that the boilerplate code may differ when it comes to technical details.</p><p>First of all, the migration script needs to be copied to the repository. Secondly, every service needs to declare it’s own repository interface for storing the intents. Then, a new instance of KafkaOutbox class with a proper repository injected needs to be created and put into the application context. Finally, the job for processing the intents has to be declared.</p><p>In this article I tried to cover the pattern in as abstract way as possible so that technical implementation details are not a blocker for anyone who is not familiar with Java. However, the challenges that might result in a different implementation are listed in the paragraph above.</p><p>Happy outboxing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1c756846d2c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dna-technology/outbox-pattern-a-quick-overview-c1c756846d2c">Outbox pattern — a quick overview</a> was originally published in <a href="https://medium.com/dna-technology">DNA Technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>